Does Xalan-Java apply keys to additional source documents loaded using
the document() function?
In an article at
http://www-106.ibm.com/developerworks/library/ws-trans/index.html?dwzone=ws,
Uche Ogbuji states that "every time an additional source document is
loaded with the XSLT document() function, all keys are applied to it
as well". However this does not seem to work with Xalan-Java 2.1.
Here is my code that doesn't work:
Input document
--------------
Anything that doesn't contain <reserved_word> elements
File java_reserved_words.xml (which is loaded using document())
----------------------------
<?xml version = '1.0' encoding = 'UTF-8' ?>
<reserved_words>
<reserved_word name="abstract" language="Java"/>
<!-- Other entries omitted for now -->
</reserved_words>
Stylesheet
----------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:key
name="java_reserved_word"
match="//reserved_word[@language='Java']"
use="@name" />
<xsl:template match="/">
<xsl:apply-templates select="key('java_reserved_word','abstract')"/>
</xsl:template>
<xsl:template match="reserved_word">
<xsl:value-of select="concat(@name, ' is a reserved word')"/>
</xsl:template>
</xsl:stylesheet>
-------------
My apologies if this is not the appropriate place for questions like
this. I couldn't find any lists or e-mail addresses that looked more
appropriate.
- Stephen