On Fri, Dec 28, 2012 at 8:38 AM, Chris Maloney <voldrani(_at_)gmail(_dot_)com>
wrote:
As for a work-around, the following works with xsltproc, but
interestingly, not with Saxon. Saxon complains "key() function cannot
be used here". (This is a variant of the XSLT that Dimitre posted on
SO):
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:key name='kTagUsage' match='tagUsage' use='@render'/>
<xsl:key name="kRendByUsageGi" match="rendition"
use="key('kTagUsage', @xml:id)/@gi"/>
<xsl:template match="/">
<xsl:copy-of select="key('kRendByUsageGi', 'p')/text()"/>
========
<xsl:copy-of select="key('kRendByUsageGi', 'emph')/text()"/>
</xsl:template>
</xsl:stylesheet>
There is a "slight" difference: I didn't use key() inside the
expression in the "use" attribute (I believe the error is raised to
prevent cirkular key definition) -- and the below transformation is
working with Saxon:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:key name="kRendByUsageGi" match="rendition"
use="../tagUsage[@render=current()/@xml:id]/@gi"/>
<xsl:template match="/">
<xsl:copy-of select="key('kRendByUsageGi', 'p')/text()"/>
========
<xsl:copy-of select="key('kRendByUsageGi', 'emph')/text()"/>
</xsl:template>
</xsl:stylesheet>
Cheers,
Dimitre
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--