This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Creating nodes for the source versus the results tree.
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "Edward L. Knoll" <ed dot knoll at cosd dot fedex dot com>
- Cc: XSL-List at lists dot mulberrytech dot com
- Date: Mon, 8 Jul 2002 19:58:46 +0100
- Subject: Re: [xsl] Creating nodes for the source versus the results tree.
- Organization: Jeni Tennison Consulting Ltd
- References: <3D29D79D.22866B62@cosd.fedex.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Ed,
> I know this is something I could do in a two pass process: during
> pass1 process of the original/source XML to create the
> intermediate/temporary XML elements, during pass2 process both the
> original XML and generated XML elements to create the final output.
> I'd rather do this in a single pass; is this possible?
Only using an extension function. You can store the result of the
first pass in a variable, but it's stored as a result tree fragment,
which means that you can't go on to process it further without turning
it into a node set. You can turn it into a node set with extension
functions; most processors have them...
> Two other notes/constraints: (1) I'm using the XalanC++ processor,
... and in Xalan-C++ it's called nodeset(), in the namespace
http://xml.apache.org/xalan. So do something like:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
extension-element-prefixes="xalan">
<xsl:template match="/">
<xsl:variable name="pass1-rtf">
<xsl:apply-templates mode="pass1" />
</xsl:variable>
<xsl:apply-templates select="xalan:nodeset($pass1-rtf)"
mode="pass2" />
</xsl:template>
...
</xsl:stylesheet>
with templates in 'pass1' mode for your first pass and in 'pass2' mode
for your second pass.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list