Subject: Re: document() question From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 22 Sep 1999 12:31:49 +0300 |
<!--note you cannot use document("")//Book[@id=$id]/*-->
T:\ftemp>type test.xml <BookList> <Book id="1"/> <Book id="2"/> </BookList>
T:\ftemp>type test.xsl <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns:data="any-uri">
<data:BookSet set="first"> <Book id="1"><Name>The wizard of OZ</Name></Book> <Book id="2"><Name>Java Servlet Programming</Name></Book> <Book id="3"><Name>John Coltrane Rage</Name></Book> </data:BookSet>
<data:BookSet set="second"> <Book id="1"><Name>An Uninteresting Book</Name></Book> <Book id="2"><Name>Another Uninteresting Book</Name></Book> <Book id="3"><Name>Yet Another Uninteresting Book</Name></Book> </data:BookSet>
<!--source of data; default can be overridden on command line--> <xsl:param name="source" select="'first'"/>
<xsl:template match="/BookList"> <!--document element--> <BookList> <xsl:for-each select="Book"> <Book id="{@id}"> <xsl:copy-of select='document("") //data:BookSet[@set=$source] /Book[@id=current()/@id]/*'/> </Book> </xsl:for-each> </BookList> </xsl:template>
-- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Website: XSL/XML/DSSSL/SGML services, training, libraries, products. Practical Transformation Using XSLT and XPath ISBN 1-894049-01-2 Next instructor-led training: 1999-09-24, 1999-11-08, 1999-12-05/06, 1999-12-07, 2000-02-27/28, 2000-05-11/12
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: document() question, G. Ken Holman | Thread | Differences in specifying variable , Miloslav Nic |
RE: calling a template, Benjamin Corliss | Date | RE: How to use xslt to transform xm, Michael Teigman |
Month |