ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
RE: [xsl] Using COUNT to create unique anchors
by Darrel Austin other posts by this author
Nov 27 2006 1:42PM messages near this date
Re: [xsl] Using COUNT to create unique anchors | RE: [xsl] Using COUNT to create unique anchors
& XSLT >  the code I posted didn't require that, it generated a unique 
>  id using xsl:number. The trick with cross referencing in xslt 
>  is to always generate the id on the _referenced_ node

D'oh! Yep, my mistake. I wasn't referencing the same nodes. 

So, I'm liking the xsl:number a bit better than the generate-ID, only
because it seems to reflect the hierarchy a bit better.

Follow-up question:

This is my XSL:

<xsl:for-each select="ruleItem"> 

	<xsl:variable name="id"> 
		<xsl:number level="multiple"/> 
	</xsl:variable> 

	<li> <a href="#id{$id}"><xsl:value-of select="number" />:
<xsl:value-of select="title" /> </a>
		<xsl:if test="ruleItem"> 
			<ul> 
				<xsl:call-template name="rulelistTOC" /> 
			</ul> 
		</xsl:if> 
	</li> 
</xsl:for-each> 

The output (numbering) of this looks like this:

1.1
1.2
  1.2.1
  1.2.2
1.3

This is OK, but I'd prefer:

1
2
  2.1
  2.2
3

I assume it does the former because every node is a child of the parent
node of the document. As such, there maybe isn't away around that?

-Darrel

--~------------------------------------------------------------------
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@[...].com> 
--~--
Thread:
Darrel Austin
Andrew Welch
Darrel Austin
Wendell Piez
Darrel Austin
Michael Kay
Darrel Austin
Andrew Welch
Darrel Austin

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved