[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Remove Duplicates from Recursive Template Calls

Subject: Re: Remove Duplicates from Recursive Template Calls
From: "Patrick Lademan" <plademan@xxxxxxxxxxxxxxxxx>
Date: Wed, 04 May 2005 17:14:20 -0500
selectbox stylesheet
Thanks again for your suggestions.  I found an Identity Transformation sample
at http://www.dpawson.co.uk/xsl/sect2/identity.html#d5391e43

I created a simple example using my existing estimate attribute.  Although
everything looks correct to the website example, I am unable to modify the
time estimate attribute.  What am I missing?

----- Identity Transformation Stylesheet -----
<!-- The Identity Transformation -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!-- Whenever you match any node or any attribute -->
  <xsl:template match="node()|@*">
    <!-- Copy the current node -->
    <xsl:copy>
      <!-- Including any attributes it has and any child nodes -->
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

----- My Stylesheet -----
<?xml version="1.0"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xalan="http://xml.apache.org/xslt"
  version="1.0" >
<xsl:import href="Identity.xsl"/>
<xsl:output method="html" encoding="UTF-8" indent="yes"
xalan:indent-amount="2" />

<xsl:template match="/project">
  <xsl:call-template name="Deliverables" />
</xsl:template>

<xsl:template name="Deliverables">
  <xsl:for-each select="/project/componentGroup">
  <xsl:if test="@type='Deliverable'">
    <xsl:for-each select="component">
      Deliverables: <xsl:value-of select="@id"/><br/>
      <xsl:call-template name="DeliverableReferences"/>
      <br/>
    </xsl:for-each>
  </xsl:if>
  </xsl:for-each>
</xsl:template>

<xsl:template name="DeliverableReferences">
  <xsl:param name="indent" select="''"/>
  <xsl:for-each select="componentReference">
  <xsl:sort select="@idRef" />
  <xsl:variable name="idRef" select="@idRef" />
      <xsl:for-each select="//component[@id=$idRef]">
          <xsl:value-of select="$indent"/>
          (<xsl:value-of select="@estimate"/>)
          <xsl:attribute name="estimate">XXX</xsl:attribute>
          <xsl:value-of select="@estimate"/>&#160;
          <xsl:value-of select="@id"/>
          <br/>
          <xsl:call-template name="DeliverableReferences">
              <xsl:with-param name="indent"
select="concat($indent,'&#160;&#160;&#160;&#160;')"/>
          </xsl:call-template>
      </xsl:for-each>
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

----- Output Results -----
Deliverables: Phase1
(6) 6  AllocationReport
     (4) 4  Markets
         (1) 1  Market
             (6) 6  SelectBox
     (4) 4  ModelYear
         (6) 6  SelectBox
(6) 6  CheckOut
     (1) 1  Market
         (6) 6  SelectBox

Deliverables: Phase2
(6) 6  SchedulingReport
     (1) 1  Market
         (6) 6  SelectBox
     (4) 4  ModelYear
         (6) 6  SelectBox

Please Note that the second @estimate printed should have XXX per the
attribute tag.

Thanks again,

Pat

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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.