xsl-list
[Top] [All Lists]

Re: Re: Remove Duplicates from Recursive Template Calls

2005-05-04 11:23:54
Why does the test for whether this is teh first node in a document depend on 
whether the template invocation is recursive?

      <xsl:for-each select="//component/@id[.=$idRef]//..">

It must locate the component that is being referenced, recurse into that 
component to follow the componentReferences to other components.  It must 
recurse until there are no more componentReferences found.

that's a very odd XPath. selecting the parent of every node below $idRef.

This locates the component that the componentReference refers.  The "//.." was 
a typo.  It should be "/..".  I took the extra slash out of the code and ran it 
again and the results are the same.  The reason that I have the "/.." is 
because node was at the component-attribute level.  Every reference I made was 
../ @attribute.  The trailing "/.." took me back to the component node level 
and therefore was much easier to make the @status and @estimate references 
without the "../" prefixes.

As a side issue I note that you are combining  indent="yes" with explictly 
addded indentation eg

          <xsl:value-of select="$indent"/>
          (<xsl:value-of select="@estimate"/>)

which adds the value of $indent followed by 10 spaces and a ( before the 
estimate.

Because the end result generates HTML.  In order to make a simple example to 
illustration of the problem I am experiencing, I removed all HTML tags for 
clarity.  I use the indent="yes" for nice HTML formatting, but not for display 
formatting.  The above data would be in an HTML table.  I will continue to use 
the indent, because I want a much smaller outline indent than the HTML LI tags 
provide.  The (@estimate) is the time estimate to develop that particular 
component.  My end goal of this project is to provide time estimates to build 
each phase of a project.  I put it in Parenthesis, because I stripped out all 
the HTML to simplify my problem.  This value will end up in it's own column 
with a subtotal per phase of delivery.

In reference to your solution:

Thank you very much for taking the time to respond.  I like your idea.  I have 
a concern that apply-templates will apply all templates in the XSL stylesheet, 
when I only want this one to execute.  Can this same process be done with a 
call-template?  This two pass concept is foreign to me, do you know a website 
with good working examples?

<xsl:template match="/">
<xsl:variable name="x">
<xsl:apply-templates/>
</xsl:variable>
<xsl:apply-templates select="xalan:node-set($x)"/>
</xsl:template>

Thank you,

Pat

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--