Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
<?xml version="1.0" encoding="utf-16"?>
<xsl:stylesheet xmlns:func="http://link/xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl s0 func" version="1.0" xmlns:s0="http://XsltFunctionsTest.Input" xmlns:ns0="http://XsltFunctionsTest.Output">
  <xsl:output omit-xml-declaration="yes" method="xml" version="1.0"/>
  <xsl:template match="/">
    <xsl:apply-templates select="/s0:Root"/>
  </xsl:template>
  <xsl:template match="/s0:Root">
    <ns0:Root>


      <Document>
        <DocumentType>
          <xsl:value-of select="func:GetDocumentTypeName()"/>
        </DocumentType>
        <MessageNumberIn>
          <xsl:value-of select="func:GetDocumentMessageNumberIn()"/>
        </MessageNumberIn>
        <MessageNumberOut>
          <xsl:value-of select="func:GetDocumentMessageNumberOut()"/>
        </MessageNumberOut>
        <DocumentNumber>
          <xsl:value-of select="func:GetDocumentNumber()"/>
        </DocumentNumber>
      </Document>

      <DocumentConfigIn>
        <Format>
          <xsl:value-of select="func:GetDocumentFormatIn()"/>
        </Format>
        <Variant>
          <xsl:value-of select="func:GetDocumentVariantIn()"/>
        </Variant>
        <Version>
          <xsl:value-of select="func:GetDocumentVariantVersionIn()"/>
        </Version>
      </DocumentConfigIn>

      <DocumentConfigOut>
        <Format>
          <xsl:value-of select="func:GetDocumentFormatOut()"/>
        </Format>
        <Variant>
          <xsl:value-of select="func:GetDocumentVariantOut()"/>
        </Variant>
        <Version>
          <xsl:value-of select="func:GetDocumentVariantVersionOut()"/>
        </Version>
      </DocumentConfigOut>

      <Distribution>
        <ConfigurationKeys>
          <UNBOverride>
            <xsl:value-of select="func:LookupDistributionConfigurationKey('UNBOverride')"/>
          </UNBOverride>
        </ConfigurationKeys>
      </Distribution>

      <InterchangeIn>
        <InterchangeNumber>
          <xsl:value-of select="func:GetInterchangeInNumber()"/>
        </InterchangeNumber>
        <InterchangeGuid>
          <xsl:value-of select="func:GetInterchangeInInterchangeGuid()"/>
        </InterchangeGuid>
        <TransmissionId>
          <xsl:value-of select="func:GetInterchangeInTransmissionId()"/>
        </TransmissionId>
        <DisplayAddress>
          <xsl:value-of select="func:GetInterchangeInDisplayAddress()"/>
        </DisplayAddress>
        <PortName>
          <xsl:value-of select="func:GetInterchangeInPortName()"/>
        </PortName>
        <FormatType>
          <xsl:value-of select="func:GetInterchangeInFormatType()"/>
        </FormatType>
      </InterchangeIn>

      <PartnerIn>
        <Name>
          <xsl:value-of select="func:GetPartnerInName()"/>
        </Name>
        <PartnerKey>
          <xsl:value-of select="func:GetPartnerInPartnerKey()"/>
        </PartnerKey>
        <Comment>
          <xsl:value-of select="func:GetPartnerInComment()"/>
        </Comment>
        <IsInternal>
          <xsl:value-of select="func:GetPartnerInIsInternal()"/>
        </IsInternal>
        <IsDeleted>
          <xsl:value-of select="func:GetPartnerInIsDeleted()"/>
        </IsDeleted>
        <MainId>
          <xsl:value-of select="func:GetPartnerInMainId()"/>
        </MainId>
        <GLN>
          <xsl:value-of select="func:LookupPartnerInIdByKey('GLN')"/>
        </GLN>
        <VendorNumber>
          <xsl:value-of select="func:LookupPartnerInConfigurationKey('VendorNumber')"/>
        </VendorNumber>
      </PartnerIn>

      <PartnerOut>
        <Name>
          <xsl:value-of select="func:GetPartnerOutName()"/>
        </Name>
        <PartnerKey>
          <xsl:value-of select="func:GetPartnerOutPartnerKey()"/>
        </PartnerKey>
        <Comment>
          <xsl:value-of select="func:GetPartnerOutComment()"/>
        </Comment>
        <IsInternal>
          <xsl:value-of select="func:GetPartnerOutIsInternal()"/>
        </IsInternal>
        <IsDeleted>
          <xsl:value-of select="func:GetPartnerOutIsDeleted()"/>
        </IsDeleted>
        <MainId>
          <xsl:value-of select="func:GetPartnerOutMainId()"/>
        </MainId>
        <CVR>
          <xsl:value-of select="func:LookupPartnerOutIdByKey('CVR')"/>
        </CVR>
        <CustomerNumber>
          <xsl:value-of select="func:LookupPartnerOutConfigurationKey('CustomerNumber')"/>
        </CustomerNumber>
      </PartnerOut>

      <ConversionTables>
        <Lookup1>
          <xsl:value-of select="func:ConversionLookupGlobalValue('Table1', 'LookupColumn1', 'Column1', 'Column1Value')"/>
        </Lookup1>
        <Lookup2>
          <xsl:value-of select="func:ConversionLookupPartnerInValue('Table2', 'LookupColumn2', 'Column1', 'Column1Value', 'Column2', 'Column2Value')"/>
        </Lookup2>
        <Lookup3>
          <xsl:value-of select="func:ConversionLookupPartnerOutValue('Table3', 'LookupColumn3', 'Column1', 'Column1Value', 'Column2', 'Column2Value', 'Column3', 'Column3Value')"/>
        </Lookup3>
      </ConversionTables>

      <LinkSettings>
        <Setting1>
          <xsl:value-of select="func:GetSettingValue('Setting1')"/>
        </Setting1>
      </LinkSettings>

      <ErrorHandling>
        <FailDocument>
          <xsl:value-of select="func:RaiseError('No lines found in order.', false())"/>
        </FailDocument>
        <FailDocumentWithErrorCode>
          <xsl:value-of select="func:RaiseError('No lines found in order.', 'RT62W', false())"/>
        </FailDocumentWithErrorCode>
        <IgnoreDocument>
          <xsl:value-of select="func:RaiseError('No lines found in order.', 'RT62W', 'Ignored', false())"/>
        </IgnoreDocument>
      </ErrorHandling>

      <ContextProperties>
        <TestProperty>
          <xsl:value-of select="func:GetContextPropertyValue('NoPropertySomeProperty', 'http://schemas.bizbrains.com/properties/test')"/>
        </TestProperty>
      </ContextProperties>

      <xsl:variable name="test" select="func:SetContextPropertyValue('SomeProperty', 'http://schemas.bizbrains.com/properties/test', 'SomeValue')" />

    </ns0:Root>
  </xsl:template>
</xsl:stylesheet>
Info

The same example is available in the Visual Studio project template where it’s possible to debug into the XSLT.

...

If your XSLT is being executed within Link, you can access the context properties of the message from the proxy classextension object.

GetContextPropertyValue(string propertyName, string propertyNamespace)

...

This method writes a value to the message context.

Data manipulation

The proxy library extension object also contains a few methods that do not extract any data from Link, but which can be useful in various mapping scenarios.

...