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

Re: numbering - counting - grouping

Subject: Re: numbering - counting - grouping
From: Frédéric SCHWEBEL <schwebel@xxxxxxxxxxxxxxxx>
Date: Wed, 8 Nov 2000 17:07:07 +0100
anna schwebel
Hi,

There's a difference between child elements and attributes. You have two
solutions :

Either you change your XML file with :
<contributor type="AU"> instead of <contributor><type>AU</type>
then type is an attribute of constructor and you can write
<xsl:apply-templates select="contributor [@type='AU']"> in your xsl sheet.

or if you want to keep your original xml file then write
<xsl:apply-templates select="contributor/type[.='AU']"> (but i'm not really
sur about the syntax here)

Does it help ?

Fred

----- Original Message -----
From: "Sellmer-Brüls, Barbara" <B.Sellmer-Bruels@xxxxxxxxxxx>
To: <XSL-List@xxxxxxxxxxxxxxxx>
Sent: Wednesday, November 08, 2000 2:52 PM
Subject: numbering - counting - grouping


> Hi,
>
> I've got a problem with numbering (or counting ? or grouping?), and I
don't
> know how to solve it with a (for some reasons given) stylesheet structure.
> The XML is as follows:
> - contains different books
> - each book can have different  contributors
> - each contributor has a type
>
> My stylesheet applies templates for <book>.
> Within <book> it applies templates to contributors depending on their
type.
>    <xsl:apply-templates select="contributor [type='AU']">
>        some sorting of all contributors = AU based on an element I have
not
> listed here
>    </xsl:apply-templates>
>    <xsl:apply-templates select="contributor [type='ED']">
>        some sorting of all contributors = ED based on an element I have
not
> listed here
>    </xsl:apply-templates>
>
> The contributor template states that
> - some output is generated only for the first occurance of a set of
> 'AUcontributors' or 'ED contributors', and
> - then that all names from the selected contributors nodes are to be
listed:
>
> <xsl:template match="contributor">
>    <xsl:if test="position()='1'">
> <xsl:value-of select="type"/><xsl:text>:</xsl:text><br/>
>    </xsl:if>
>    <xsl:value-of select="name"/><br/>
> </xsl:template>
>
> What I need to add to the output a numbering of the contributors 'header'
> data, so that the output looks like:
> book 1
> 1. type is AU
> Anna
> 2. type is ED
> Ernst
> Elisabeth
>
> book2
> 1. type is AU
> Andrew
> 2. type is CON
> Cindy
>
> I tried it with variables and parameters but it does not work.
> Has anybody any Idea?
>
> This is the XML document:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <list>
>   <book>
>    <id>1</id>
>    <contributor>
>       <type>AU</type>
> <name>Anna</name>
>    </contributor>
>    <contributor>
>       <type>ED</type>
> <name>Ernst</name>
>    </contributor>
>    <contributor>
>       <type>ED</type>
> <name>Elisabeth</name>
>    </contributor>
>  </book>
>  <book>
>    <id>2</id>
>    <contributor>
>       <type>AU</type>
> <name>Andrew</name>
>    </contributor>
>    <contributor>
>       <type>CON</type>
> <name>Cindy</name>
>    </contributor>
>  </book>
> </list>
>
> Sorry for this lengthy email - but thanks in advance!
> Barbara
> ---
> Barbara Sellmer-Bruels
> b.sellmer-bruels@xxxxxxxxxxx
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 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.