1

Good Day!

So I've been looking around to for a solution to a problem I have in an integration project with SAP Business One Integration framework.

The long and short of it is that I need to pass the value of an xsl function to serve as the value for an xml element's attribute.

As such:(Or rather, this is what I'm trying to achieve)

<Party role=<xsl:value-of select="$msg/BOM/BO/BPAddresses/row/AddressType"/>>
    <PartyIDs>
      blahblah

I was wondering. Is it possible to maybe pass a variable to the attribute instead? Kinda new to xslt and the lot..so any advice would be appreciated. Thank you in advance!

Medismal
  • 421
  • 3
  • 18

1 Answers1

4

You need to use Attribute Value Templates here. This is the syntax you looking for

<Party role="{$msg/BOM/BO/BPAddresses/row/AddressType}">
    <PartyIDs>
       blahblah

The curly braces indicates an expression to be evaluated, rather than output literalally.

Note that you can also use the xsl:attribute command

<Party>
    <xsl:attribute name="role">
        <xsl:value-of select="$msg/BOM/BO/BPAddresses/row/AddressType"/>
    <xsl:attribute>
    <PartyIDs>
       blahblah

But as you can see this is a bit more verbose, and Attribute Value Templates are usually the way to go.

Tim C
  • 70,053
  • 14
  • 74
  • 93