Subject: Re: document() question From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 16 Sep 1999 07:24:17 -0700 |
At 99/09/15 20:11 -0700, Terris wrote:...I have a string in a variable and I want to convert it to a document via the document() function.
Trying to feed a variable of rich markup to the document() function is impossible.
T:\ftemp>type doc2.xml <BookList> <Book id="1"/> <Book id="2"/> </BookList>
T:\ftemp>type list4.xsl <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:variable name="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> </xsl:variable>
<xsl:variable name="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> </xsl:variable>
<!--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:variable name="id" select="string(@id)"/> <xsl:for-each select='document("")'><!--the stylesheet--> <xsl:copy-of select="//xsl:variable[@name=$source] /Book[@id=$id] /*"/> </xsl:for-each> </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 | Re: document() question, G. Ken Holman |
RE: What will be the future improve, DPawson | Date | RE: What will be the future improve, Khun Yee Fung |
Month |