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

RE: problem with node-set pattern

Subject: RE: problem with node-set pattern
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Fri, 6 Jul 2001 13:56:22 +0100
mike schaefer
> In my XML-doc I have several entities, which I want to number.

Actually, they are called elements...
> Then I thought of using
>
> <xsl:template match="TABLE1/*[1] | TABLE2/*[1]">
> 	<xsl:element name="{name(..)}_LNR">
> 		<xsl:number count="{name(..)}" level="single"/>
> 	</xsl:element>
> 	<xsl:copy>
> 		<xsl:apply-templates select="node()"/>
> 	</xsl:copy>
> </xsl:template>
>
> But the Processor (Infoteria) says:invalid pattern in count attribute.

Quote right too. You can't have curly braces in an attribute where an
expression or pattern is required.

One solution is not to use xsl:number at all. Very often its easier and more
flexible to use something like

<xsl:value-of select="count(../preceding-sibling::*[name()=$name])"/>

Another approach is to make the parent node current before calling
<xsl:number>. For example

<xsl:template match="*" mode="number">
  <xsl:number/>
</xsl:template>

and then
<xsl:apply-templates select=".." mode="number"/>
in the place where you currently call <xsl:number/>

Mike Kay
Software AG
>
> What can I do?
>
> Mit freundlichen Grüßen
> Michael Schäfer
>
> ---------------------------------------------------------------
> Dipl.-Ing. Michael Schäfer
> e-business
>
> Pfeil GmbH
> Obertorstr. 4-6
> 66111 Saarbrücken
>
> Tel.: 06 81/3 79 85-30
> Fax: 06 81/3 79 85-13
>
> e-Mail: mschaefer@xxxxxxxxxxxx
> Internet: www.pfeilgmbh.de
>
>
>  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.