Hi,
I encountered following problem with following xml/xslt pair (I tried it
with Xalan/xsltc 2.4.D1 build):
XML is:
<?xml version="1.0"?>
<config>
<period-types>
<period-type id="fn" label="Q#"/>
</period-types>
<fields>
<field name="f1">
<period type="fn"/>
</field>
</fields>
</config>
XSLT is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:variable name="period-type"
select="config/period-types/period-type"/>
<fields>
<xsl:for-each select="config/fields/field">
<xsl:variable name="period" select="period"/>
<field name="{@name}">
<period type="{$period/@type}"
label="{$period-type[@id = $period/@type]/@label}"/>
</field>
</xsl:for-each>
</fields>
</xsl:template>
</xsl:stylesheet>
Using Xalan gives result (which is correct):
<?xml version="1.0" encoding="UTF-8"?>
<fields>
<field name="f1">
<period label="Q#" type="fn"/>
</field>
</fields>
Using XSLTC gives result (not correct):
<?xml version="1.0" encoding="UTF-8"?>
<fields>
<field name="f1">
<period type="fn" label=""/>
</field>
</fields>
As you can see, in the XSLTC result attribute @label is empty, while it
should be the same as in case of Xalan usage. So it looks like X-Path
expression "$period-type[@id = $period/@type]/@label" doesn't work correctly
in case of xsltc. To be more exact I think "$period/@type" part in predicate
is not executed right, b/c if you'd replace it with constant value
everything will be fine.
Have anyone reported this problem? I didn't find it in bugzilla. I can go
ahead and submit it as a xsltc bug there. I didn't test it with latest Xalan
build from CVS so it could have been fixed already.
Thanks,
Dmitry