On 29.10.2014 20:44, Catherine Wilbur cwilbur(_at_)uwindsor(_dot_)ca wrote:
*_Below in my xsl code am getting a syntax error on the following line_*
<xsl:variable name="CurrDateTimeValue"
select="format-dateTime(current-dateTime(),"[Y0001][M01][D01][H01][m01]")"/>
Use single quotes to delimit the picture string when you used double
quotes for the select attribute.
select="format-dateTime(current-dateTime(),'[Y0001][M01][D01][H01][m01]')"
Element type "xsl:variable" must be followed by either attribute
specifications, ">" or "/>".
…
…
<xsl:choose>
<xsl:when test="contains-case-insensitive($InvoicePOLineOwner,
'Law')">
<xsl:variable name="POOwnerType" select="W'" />
</xsl:when>
<xsl:otherwise>
<xsl:variable name="POOwnerType" select="L" />
</xsl:otherwise>
</xsl:choose>
This won’t work because
a) the scope of the variable declarations will be limited to the
xsl:when and xsl:otherwise branches, respectively. There won’t be a
variable $POOwnerType outside of them.
b) the strings 'W' and 'L' aren’t properly delimited
c) there is no function contains-case-insensitive()
Use this for the variable declaration:
<xsl:variable name="POOwnerType" as="xs:string">
<xsl:choose>
<xsl:when test="matches($InvoicePOLineOwner, 'Law', 'i')">
<xsl:sequence select="'W'"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="'L'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
or shorter
<xsl:variable name="POOwnerType" as="xs:string"
select="if (matches($InvoicePOLineOwner, 'Law', 'i'))
then 'W' else 'L'"/>
If you use an editor such as oXygen it will make you aware of all these
issues, thanks to the embedded Saxon processor.
Because the XML input lacks essential parts, I was unable to validate
the remainder of your XSLT’s functionality. If you want me to check it,
you may send me a complete input off-list. Of course you might ask the
next question on the list when you encounter the next hurdle. Keep on
exploring XSLT 2, it’s totally worth it!
Gerrit
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--