[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: document() revisited
Subject: Re: document() revisited From: Steve Tinney <stinney@xxxxxxxxxxxxx> Date: Thu, 17 Feb 2000 08:49:51 -0500 |
> It's the "write new contents" that's bugging me now: > I wish to go through each file and copy those nodes to the > result tree that EITHER have no "lang" attribute set, > or that DO NOT have lang="german" or lang="french". > It seems that I can copy either everything or nothing, > since only the HTML root seems to be selected by any expression > I try (is this the "lazy evaluation" you speak of, Steve?). My concern in my inital post was that the lazy evaluation (delayed evaluation of the variable) might result in the file being opened by xt:document for writing before it gets opened by document() for reading. I just experimented a little and discovered that this is not so much of a concern, though you do need to call document() outside the xt:document block. So, instead of saving stuff into a variable, you can just do something like the following, and subset the document using a select on xsl:copy-of or xsl:apply-templates as suggested by Mike Kay and David Carlisle. Steve <xsl:template match="file"> <xsl:variable name="path" select="."/> <xsl:variable name="contents" select="document($path)"/> <xt:document method="html" href="{$path}"> <xsl:apply-templates select="$contents"/> </xt:document> </xsl:template> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Inclusion of XML data in Javascript, Philip McAllister | Thread | RE: document() revisited, Kay Michael |
RE: Is there any way to access user, Ben Robb | Date | large and small numbers in xsl, DUDGEON |
Month |