Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Recursively including all dependencies of an element

From: Scott Sauyet <Scott.Sauyet@-----.--->
To: 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



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent