Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: 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/5/2007 9:42:00 AM
Scott Sauyet wrote:
> David Carlisle wrote:
>> I'm not quite sure what output format you want but probably something
>> like this in xslt1 will chase your dependencies
> I actually need to output format to be identical to the input format,
> just with a smaller set of elements chosen. It was pretty simple to
> modify your suggestion, though, to get that. Thank you again for your
> help.
I suppose I should double-check that I'm looking at the output of my
new process rather than the old one before I claim that it's
working! :-(
Things aren't working correctly in Ant1.7/Java1.6. When I run them
through Saxon, though, it's all fine. Any idea what might be causing
this?
I was going to move this into my main code and noticed an odd bit in
my output. I had been looking at the output of an earlier version
before; the one I called the ugly hack. So I ran again with David'
Carlisle's code and noticed a subtle difference in output:
David Carlisle's
>> 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
Mine:
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
Note the extra space after "Stage 3 set is"? And stage 4 too? This
is the output of
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
for the context node of the third and fourth iteration, which seems to
be the document node itself. !!?? I checked this by inserting a line
that counts the child elements of the context node:
<xsl:value-of select="count(.//*)"/><xsl:text>:</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
And I get this output:
Stage 1 set is 2:a 1:b
Stage 2 set is 2:a 1:b 1:c 1:g
Stage 3 set is 20: 2:a 1:b 1:c 1:g 1:h
Stage 4 set is 20: 2:a 1:b 1:c 1:g 1:h 0:i
Note that the input document has twenty elements, and the counts in
this list for the number of elements inside the named elements are all
correct (x[@name='a'] has two children, 'b' has one, ... 'i' has
zero.)
I can't understand how this line:
<xsl:variable name="nset" select="$set|key('x',$set/y/@dep)"/>
with the key
<xsl:key name="x" match="x" use="@name"/>
and a $set value that contains only elements of type "x" could ever
generate a value for $nset that includes the root node. But that is
certainly what seems to be happening.
I thought I was just going crazy, but I've realized it's not me, it's
my XSLT processor that's awry. When I run it through SAXON,
everything works fine.
Anyone have an idea what this is about?
-- Scott
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
