XSL Parameter Quoting

When passing parameters values to the XSL engine that are string constants, those values must be quoted twice.

<$names = "lang">
<$values = "'EN'">
<$result = (xsltApplyStylesheet($doc, $style, $names, $values))>

The values get two sets of quotes around them, both double and single. The Vortex assignment consumes the outer double quotes, which sets the Vortex variable $values to 'EN'. When the variable is referenced in XSL using <xsl:value-of select="$lang"/>, it resolves to <xsl:value-of select="'EN'"/>. This selects 'the string constant EN', which the desired behavior.

If the Vortex variable is set as <$values = "EN">, then Vortex consumes the quotes and the Vortex variable $values gets the value EN. When this is accessed in XSL using <xsl:value-of select="$lang"/>, it resolves to <xsl:value-of select="EN"/>. This selects 'the contents of the element <EN> in the XML document being transformed'.


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.