[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: document() revisited

Subject: Re: document() revisited
From: Steve Tinney <stinney@xxxxxxxxxxxxx>
Date: Thu, 17 Feb 2000 08:49:51 -0500
Re: document() revisited
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.