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

Re: More Multi-Document Mambo

Subject: Re: More Multi-Document Mambo
From: Laurence O Garfield <lgarfiel@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Jul 2001 12:36:43 -0500 (CDT)
laurence garfield
On Wed, 18 Jul 2001, David Carlisle wrote:

> > But what exactly is happening internally with the trees,

> not sure what you want to know, but possibly the answer is that the
> XPath model gives you an ordered sequence of distinct trees coming from
> document() (and xx:node-set() and any otehr external function
> thatgenerates a tree). / always refers to the tree containing the
> current node.
>
> > and is there any way to differentiate between them so that the identity
> > transform doesn't pass through stuff from one of the trees?
>
> the default apply-templates will never pass from one tree to another
> as none of the axis cross a tree, so your transform will only move from
> one tree to another if you explictly apply-templates select="document(...
>
>
> David

OK, so when I apply-templates to another document() tree explicitly, I am
jumping explicitly out of the current tree?  If I apply-templates into
treeB from treeA, and then in some template check for a given ancestor
that is in treeA but not treeB, should it return true or false?

Code wise:

treeA: book/part/section/para
treeB: html/body

<xsl:template match="book/part/section">
	<xsl:apply-templates select="document('treeB.xml')" />
</xsl:template>

<xsl:template match="body">
	<xsl:if test="Boolean(ancestor::part)" >
		Bingo!
	</xsl:if>
</xsl:template>

<!-- Identity template here -->

Will "Bingo!" be output?

It's not that <apply-templates /> is passing from one tree to another.
It's that I want the default rule for one tree to be the identity
transformation (the template file), and the default rule for the other to
be the normal pass-through template.  However, if I include the identity
transformation in the script then it is the default rule for BOTH trees,
when I <apply-templates /> in each one individually.  Hense my question
about the relationship between the trees, as the only way I can see to do
that is to put a test inside the identity template that says "if this node
is part of treeA pass it through the identity template, otherwise ignore
it."  Unless there is a better way to do it?

Thanks for putting up with me asking the same question over and over
again. :-)

--Larry Garfield


 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.