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

Re: document tree fragments

Subject: Re: document tree fragments
From: Joe Barwell <jbar@xxxxxxxx>
Date: Mon, 13 Oct 2008 01:12:04 +1300
Re:  document tree fragments
David Carlisle wrote:
Is there a way to use my $thePath variable, instead of including the directory path inside the @filename attribute?

yes:


<docs path="jb">
	<doc filename="wine1.xml" />
	<doc filename="wine2.xml" />
	<doc filename="wine3.xml" />
	...
</docs>


<xsl:template match="docs"> <xsl:variable name="p" select="document(concat(@path,'/',doc[1]/@filename))"/> <xsl:variable name="z" select="document(doc/@filename,$p)"/> <xsl:for-each select="$z"> : <xsl:value-of select="."/> </xsl:for-each> </xsl:template>


puts all the document nodes in $z.

Hi David,


Thanks, a somewhat sneaky idea--I like it! The for-each is superfluous/breaks things, but the following works for me (NB, now moved to the top of my xsl stylesheet, rather than in a template match):

<xsl:variable name="thePath" select="document(concat(/docs/@path, '/',
/docs/doc[1]/@filename))" />
<xsl:variable name="theWines" select="document(/docs/doc/@filename,
$thePath)" />

Cheers!

Joe

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.