xsl-list
[Top] [All Lists]

RE: [xsl] Numbering Consecutive Nodes

2006-05-31 04:52:29
David,

Thanks for the rapid response - its been a while since I really worked
XSLT with anything more complicated than simple templates.

Your suggestions have worked successfully - one question though - why do
the nodes start numbering from 624 rather than 1?

Best Regards,

Mark Grant

-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk] 
Sent: 31 May 2006 12:10
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Numbering Consecutive Nodes



        <xsl:template match="PageContent//node()">

I don't think that you want to match _all_ nodes below PageContent This
would include text nodes comments and anything else. If you apply
templates to any text node this template will generate an error as
                <xsl:copy>
will copy the text node but then        <xsl:attribute name="id">
will try to make an attribute on a text node which obviously isn't
allowed. Change node() to * in the match pattern.

By default xsl:number just counts children of the current parent you
want
<xsl:number level="any"/>

                <xsl:apply-templates
select="PageContent//node()" />

This selects all descendents of the PageContent child of the current
node. However the current node (which is a descendent of PageContent)
has no PageContent child so this will select nothing.

You just want
<xsl:apply-templates/>
here the default behaviour of just processing the child nodes is what
you want. (Lower descendendts will be recursively processed when the
templates matching the child nodes are executed.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>