Subject: [xsl] xsl:key, predicates and documents. From: Nic Gibson <nicg@xxxxxxxxxx> Date: Fri, 14 May 2010 13:28:18 +0000 |
Afternoon I've found myself confused by something I thought that I understood so I'm hoping for some enlightenment. We have a fairly massive document that is used as a lookup when processing other documents. Right now, we have the big document used as the primary input to stylesheet and the document actually being processed is loaded via document(). The big document can be partioned on an attribute. The lookups done in this document depend on the attribute value in both the input and the lookup. That is, if the @PER attribute is 'n' then we will be doing lookups based on the @HW attribute and if 'y' on the @SUR attribute. So, I created keys that look like this: <xsl:key name="term-key" select="e[@PER='n']" use="@HW"/> <xsl:key name="person-key" select="e[@PER='y']" use="@SUR"/> Our root template matches the other document and processes it so: <xsl:param name="in-file"/> <xsl:variable name="in-doc" select="document($infile)"/> <xsl:template match="/"> <output> <xsl:apply-templates select="$in-doc/xData/eData"/> </output> </xsl:template> <xsl:template match="eData[@PERS='n']"> <xsl:variable name="exact" select="key('term-key', @HW)"/> ... </xsl:template> We know that there are matches yet this doesn't work unless we remove the predicate from the key definition. Are predicates usable in key definitions? On a related noted, is there any way to reverse this so that the key data is loaded from document()? cheers nic
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] character map "range" in , Liam R E Quin | Thread | Re: [xsl] xsl:key, predicates and d, Andrew Welch |
Re: [xsl] character map "range" in , steve.majewski@xxxxx | Date | Re: [xsl] xsl:key, predicates and d, Andrew Welch |
Month |