Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Recursively including all dependencies of an element >Thread Next - Re: Recursively including all dependencies of an element Re: Recursively including all dependencies of an elementTo: NULL Date: 6/4/2007 11:01:00 PM Scott Sauyet wrote: > I would rather be using node- > sets. But whenever I tried that, I ran into issues of variables that > held things that looked like but weren't really node-sets. > result tree fragments. If using XSLT2 is an option then that particular problem goes away as rtf is no more (node sets are also gone) both replaced by sequences. I'm not quite sure what output format you want but probably something like this in xslt1 will chase your dependencies <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" omit-xml-declaration="no" /> <xsl:param name="base" select="'a b'"/> <xsl:key name="x" match="x" use="@name"/> <xsl:template match="root"> <xsl:param name="set" select="x[contains($base,@name)]"/> <xsl:param name="s" select="1"/> Stage <xsl:value-of select="$s"/> set is <xsl:for-each select="$set"> <xsl:value-of select="@name"/> <xsl:text> </xsl:text></xsl:for-each> <xsl:variable name="nset" select="$set|key('x',$set/y/@dep)"/> <xsl:if test="count($nset)>count($set)"> <xsl:apply-templates select="."> <xsl:with-param name="set" select="$nset"/> <xsl:with-param name="s" select="$s+1"/> </xsl:apply-templates> </xsl:if> </xsl:template> </xsl:stylesheet> $ saxon dep.xml dep.xsl <?xml version="1.0" encoding="utf-8"?> Stage 1 set is a b Stage 2 set is a b c g Stage 3 set is a b c g h Stage 4 set is a b c g h i -- http://dpcarlisle.blogspot.com | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
