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

RE: top level params and xsl:attribute magic?

Subject: RE: top level params and xsl:attribute magic?
From: "Conal Tuohy" <conalt@xxxxxxxxxxxxxxx>
Date: Thu, 23 Jan 2003 19:16:40 +1300
top con
Simon wrote:

> ... My XSLT
> applies templates to the RNG file until it hits a
> <zeroOrMore> node. At
> that point it spits out the XPath to that node, as the value
> of an HTML
> forms button. The button posts the XPath back to the same
> XSLT. At that
> point, I want to start at the node, given by the xpath, and apply my
> templates again to the descendants of the Xpath.

If you are generating this xpath parameter yourself in XSLT, and it refers
to a single node, then it should also be simple enough to parse as a string,
in XSLT. It's not as if your parser would have to parse any xpath expression
is it?

I assume your generated xpath expression looks something like:

"foo[2]/bar[1]/baz[23]"

You can evaluate this against your document with a recursive named template:
pass it a the xpath string and a root node, and have it parse the string up
to the first slash, extract the number from the square brackets, and select
the matching child node using something like
"node()[name()=$node-name][position()=$position]". This is the first step in
the xpath. Then it can call itself recursively, passing the remainder of the
xpath string and this child node. If there are no more steps in the xpath,
the template can call apply-templates to process the final node.

Cheers!

Con


 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.