I'm using Saxon 9b
I must have a typo somewhere.. but I don't know where.
Here's the code:
Code:
<xsl:variable name="attrSubTree">
<xsl:for-each select="$ratttable//TL1Attribute">
<xsl:variable name="attrName">
<xsl:value-of select="."/>
</xsl:variable>
<ATTR>
<xsl:value-of select="$attrName"/>
</ATTR>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="namedSubTree">
<NAMEDBLOCK BLOCK="4">
<xsl:for-each select="$attrSubTree/ATTR">
<xsl:variable name="attrName2">
<xsl:value-of select="."/>
</xsl:variable>
<xsl:if test="string-length($attrName2) > 0">
<xsl:if test="count($syntaxSubTree//KEYWD[. = $attrName2]) = 0">
<KEYWD>
<xsl:value-of select="$attrName2"/>
</KEYWD>
</xsl:if>
</xsl:if>
</xsl:for-each>
</NAMEDBLOCK>
</xsl:variable>
<!--
Dump The Named Attribute SubTree
<xsl:text>
</xsl:text>
<xsl:text>Named Keywords</xsl:text>
<xsl:text>
</xsl:text>
<xsl:for-each select="$namedSubTree/NAMEDBLOCK/KEYWD">
<xsl:text>Attribute: </xsl:text>
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:for-each>
-->
The error I get is:
[Saxon-B 9.0.0.6] Required item type of value of variable $attrName2 is document-node(); supplied value has item type xs:untypedAtomic
If I un-comment the Dump code following the variable definition, the error goes away.
If I add a single line <text> prior to the attrSubTree definition, the error goes away.
Code:
<!--
First, create a subtree with all the attribute names in the Attribute Table
-->
<xsl:text>
</xsl:text> <-- Added Line
<xsl:variable name="attrSubTree">
<xsl:for-each select="$ratttable//TL1Attribute">
<xsl:variable name="attrName">
<xsl:value-of select="."/>
</xsl:variable>
<ATTR>
<xsl:value-of select="$attrName"/>
</ATTR>
</xsl:for-each>
</xsl:variable>
If, instead, I add the <text> after the attrSubTree definition, the error does not go away.
Does anyone see something that I'm missing?
Thanks