|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: this script converts an instance path to an RNG pa
How it works ...
On Monday, March 31, 2003, at 06:02 PM, S Woodside wrote: It's a recursive template, $fragment gets ever shorter, it pulls steps off the front of the string. fragment must be an XPath string from an instance document that conforms to a given RNG grammar <xsl:choose> That section eliminates any leading "/" if there is one and recurses without it. This section inserts //*[@name=' ... (since the instance node steps are encoded into the RNG as attributes called "name"). There can be arbitrary steps inbetween name-defining nodes in RNG that might define optional, zeroOrMore, etc. so // just skips them. this section coming up will insert a single step in the XPath. It used a choose because the substring-before() xpath function returns nothing if the "before" string isn't found (as opposed to returning the whole string) so that if this is the last recursive step, and there is no "/" it will just select $fragment Now we will either recurse if there's something left to process, or stop recursing <xsl:choose> that recursed after snipping off the first node step that add /* to the end to select all children (maybe not necessary though) That's all. simon XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








