[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: The right way to count from inside a match templat
Subject: Re: The right way to count from inside a match template
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 09 Mar 2005 14:46:15 -0500
|
Hi nutdev,
At 01:59 PM 3/9/2005, you wrote:
I have an xsl which is something like this:
<root>
<a><b>lots of stuff</b></a>
<a><b>lots of stuff</b></a>
<a><b>lots of stuff</b></a>
<a><b>lots of stuff</b></a>
<a><b>lots of stuff</b></a>
<a><b>lots of stuff</b></a>
<a><b>lots of stuff</b></a>
</root>
and I have a template
<xsl:template match="a">
<!--Show which element I on using-->
<!--display lots of stuff-->
</xsl:template>
For the <!--Show which element I on using--> I am trying various
different combinations
of <xsl:number value="something">
Take the @value attribute off and see what happens. You do not want to
provide a value to the xsl:number instruction; without it, it will
calculate a value on its own (which is what you want).
Any good XSLT reference book will tell you what the @value, @count, @level
and @format attributes on xsl:number will do, but from your description it
appears you want the default behavior.
I have tried counting preceding siblings, position and several other
things, and I only ever get
a 1.
We'd have to see a little more before we could diagnose why that was
happening.
I would be really grateful if you could tell me What is the right way to
show 1,2,3,4,5 and then contents of each 'a4 element within the
template.
D'you know how to apply templates?
<xsl:template match="a">
<xsl:number format="1 "/>
<xsl:apply-templates/>
</xsl:template>
Cheers,
Wendell
======================================================================
Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|