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

Grouping by an attribute of a child

Subject: Grouping by an attribute of a child
From: David Christiansen <DavidCh@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Apr 2003 11:12:43 -0600
attribute activity
Hi,

I am trying to group records together so I can do subtotaling and page
breaks.  I need to do this when the element "Attribute" with Attribute
"Railcar Number" has the attribute "Value" changes (Sample XML below)  Not
all records will have an element "Attribute" with a name "Railcar Number"
(if that has anything to do with anything)

By the time I enter the "Activity" template, I have already done sorting by
Railcar Number, then Activity Date.  At the first of this, I do check to see
if I am on the first record to prevent doing a page break at this point.
This part seems to work.  The second test is one of the many attempts that I
have tried without success.

If there is anyone with some help, I would appreciate this.

Thanks,

David Christiansen


Fragments of xsl and xml files:


-----XSL-----
  <xsl:template match="Invoices/Invoice/Activity">
    <xsl:if test="position()!=1">
        <xsl:if test="Attribute[@Name='Railcar
Number']/Value=preceding-sibling::*[1]/Attribute[@Name='Railcar
Number']/Value">
          <fo:block font-size="10.0pt" font-family="serif"
text-align="start">
            page break
          </fo:block>
        </xsl:if>
      </fo:table-row>
    </xsl:if>
    <xsl:apply-templates select="Revenue"/>
  </xsl:template>


-----XML-----
<Invoices>
  <Invoice>
    <Activity>
      <ActivityDate>
        04/07/2003
      </ActivityDate>
      <Attribute ID="562386" Name="Dollars" Value="232">
      </Attribute>
      <Attribute ID="562387" Name="Description" Value="Charge">
      </Attribute>
    </Activity>
    <Activity>
      <ActivityDate>
        04/05/2003
      </ActivityDate>
      <Attribute ID="562406" Name="Railcar Number" Value="ZXCV">
      </Attribute>
      <Attribute ID="562407" Name="Bill Of Lading" Value="AAA">
      </Attribute>
    </Activity>
    <Activity>
      <ActivityDate>
        04/04/2002
      </ActivityDate>
      <Attribute ID="562416" Name="Hours" Value="2">
      </Attribute>
      <Attribute ID="562417" Name="Audit Number" Value="123">
      </Attribute>
      <Attribute ID="562418" Name="Railcar Number" Value="ZXCV">
      </Attribute>
    </Activity>
    <Activity>
      <ActivityDate>
        04/07/2002
      </ActivityDate>
      <Attribute ID="562427" Name="Hours" Value="3">
      </Attribute>
      <Attribute ID="562428" Name="Railcar Number" Value="QWERT">
      </Attribute>
    </Activity>
    <Activity>
      <ActivityDate>
        04/06/2003
      </ActivityDate>
      <Attribute ID="562429" Name="Dollars" Value="150">
      </Attribute>
      <Attribute ID="562430" Name="Railcar Number" Value="QWERT">
      </Attribute>
    </Activity>
  </Invoice>
</Invoices>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.