xsl-list
[Top] [All Lists]

Re: [xsl] document tree fragments

2008-10-11 18:16:07


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.

Secondly, I'm not sure I fully understand what my $theWines variable now 
contains. I believe it is a collection of tree fragments--i.e. there's 
no single top-most node, is that right? Or is there an implicit / 
(document) node?


No, ots a set of element nodes, each of which has a (different) root
node (/) as parent.


The reason I ask is because I have some templates that rely on 
processing the preceding axis, and whereas my templates work fine for my 
< wines > xml file, they do not produce the anticipated results when 
using my $theWines variable.

Yes, nodes in different documents are not related by any axis.


David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>