xpath with multiple predicates not giving right value
I am parsing some DocBook xml to convert to our internal format.
In processing a tgroup element like the following:
<tgroup cols="4">
<colspec colwidth="1*" />
<colspec colwidth="1*" />
<colspec colwidth="1*" />
<colspec colwidth="1*" />
If a given tgroup's col attribute value matches exactly the number of
child colspec elements AND there is a colwidth attribute for that colspec,
i want to use the colwidth value in the colspec element in the result
tree.
My check and the code is as follows:
<xsl:when test="(@cols = count(./colspec)) and
(./colspec[@colwidth][$number])">
<colspec>
<xsl:attribute name="colnum">
<xsl:value-of select="$number"/>
</xsl:attribute>
<xsl:attribute name="colname">
<xsl:value-of select="$number"/>
</xsl:attribute>
<xsl:attribute name="colwidth">
<xsl:value-of select="./colspec[@colwidth][$number]"/>
</xsl:attribute>
</colspec>
($number is the number of the current colspec being processed.) Instead of
getting the colwidth of 1*, i just get
coldwidth=""
Do i need to specify that i want the attribute value?
I always get kind of tripped up on the xpath expressions, any help any one
can provide is greatly appreciated!
Thanks,
Russ
No comments:
Post a Comment