|
Subject: document() question From: "Terris" <terris@xxxxxxxxxx> Date: Wed, 15 Sep 1999 20:11:34 -0700 |
I have a string in a variable and I want to convert it
to a document via the document() function.
Given the following example, it's obvious that I would
get an error because document() is treating the variable's contents
as a filename.
I presume that I am trying to do the
impossible but I thought I would ask anyway.
Thanks in Advance, Terris
G:\xsl>xt doc2.xml doc2.xsl
java.io.FileNotFoundException: \G:\xsl\askldf
The wizard of OZJava Servlet ProgrammingJohn Coltrane Rage
G:\xsl>type doc2.xml
<BookList>
<Book id="1"/>
<Book id="2"/>
</BookList>
G:\xsl>type doc2.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="source">askldf
<BookSet>
<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>
</BookSet>
</xsl:variable>
<xsl:template match="/BookList"> <!--document element-->
<BookList>
<xsl:for-each select="Book">
<Book id="{@id}">
<xsl:variable name="id" select="string(@id)"/>
<!--note you cannot use document($source)/id($id)-->
<xsl:for-each select="document($source)">
<xsl:copy-of select="id($id)/*"/>
</xsl:for-each>
</Book>
</xsl:for-each>
</BookList>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Old vs. New and LotusXSL, Sunil Jain | Thread | Re: document() question, G. Ken Holman |
| Re: xsl:fo in web browsers, James Tauber | Date | Re: expressing DTDs with UML, Dave Carlson |
| Month |