|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: variable question
Hi Bruce,
At 02:51 PM 11/10/2004, you wrote: In XSLT 1.0 the only way to do this would be by using a stylesheet to generate your stylesheet. Nope. A key can be used to retrieve nodes dynamically, but it's a way around slow and tortuous XPaths (that is, an optimization that XPath offers itself), not a way of manipulating XPath. I'm confused (again!). I'm basically trying to rework some of my code, in part based around Geert's suggestions, but I can't really see how to do what I'm wanting to do (which is to be able to work on content from external files). It seems, for example, that I cannot use a key on content I want to access via the doc function. You mean the document() function, I take it. But no, you're not going to be able to use key() to retrieve nodes dispersed throughout an arbitrary number of external documents. It works on one document at a time. If you know all your nodes of interest are in a single document, you can change context to that document and use key() therein: <xsl:variable name="bibrecord" select="document(concat('bib-data/', $bibkey, '.mods'))" /> <xsl:key name="biblio" match="mods:mods" use="@ID" /> <xsl:template match ...>
<xsl:variable name="key-value" select="[your key value]"/>
<!-- ... now changing context to the bibrecord document -->
<xsl:for-each select="$bibrecord">
<!-- ... now changing context to the key-retrieved element
inside the bibrecord doc -->
<xsl:for-each select="key('biblio', $key-value">
... do your thing ...
</xsl:for-each>
</xsl:for-each>
</xsl:template>But I'm not sure that's quite enough to give you what you need. Maybe. Cheers, Wendell
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








