[xsl] problem with node-set pattern

Subject: [xsl] problem with node-set pattern
From: Michael Schäfer <MSchaefer@xxxxxxxxxxxx>
Date: Fri, 6 Jul 2001 13:54:49 +0200
In my XML-doc I have several entities, which I want to number. The in
the target the numbers should be included

source:
<ROOT>
	<TABLE1>
		<EL1>A</EL1>
	</TABLE1>
	<TABLE1>
		<EL1>B</EL1>
	</TABLE1>
	<TABLE1>
		<EL1>C</EL1>
	</TABLE1>
	<TABLE1>
		<EL1>D</EL1>
	</TABLE1>
	<TABLE1>
		<EL1>E</EL1>
	</TABLE1>
	<TABLE1>
		<EL1>F</EL1>
	</TABLE1>
	<TABLE2>
		<EL2>A</EL2>
	</TABLE2>
	<TABLE2>
		<EL2>B</EL2>
	</TABLE2>
	<TABLE2>
		<EL2>C</EL2>
	</TABLE2>
	<TABLE2>
		<EL2>D</EL2>
	</TABLE2>
	<TABLE2>
		<EL2>E</EL2>
	</TABLE2>
	<TABLE2>
		<EL2>F</EL2>
	</TABLE2>
</ROOT>
Target
<ROOT>
	<TABLE1>
		<TABLE1_LNR>1</TABLE1_LNR>
		<EL1>A</EL1>
	</TABLE1>
	<TABLE1>
		<TABLE1_LNR>2</TABLE1_LNR>
		<EL1>B</EL1>
	</TABLE1>
	<TABLE1>
		<TABLE1_LNR>3</TABLE1_LNR>
		<EL1>C</EL1>
	</TABLE1>
	<TABLE1>
		<TABLE1_LNR>4</TABLE1_LNR>
		<EL1>D</EL1>
	</TABLE1>
	<TABLE1>
		<TABLE1_LNR>5</TABLE1_LNR>
		<EL1>E</EL1>
	</TABLE1>
	<TABLE1>
		<TABLE1_LNR>6</TABLE1_LNR>
		<EL1>F</EL1>
	</TABLE1>
	<TABLE2>
		<TABLE2_LNR>1</TABLE2_LNR>
		<EL2>A</EL2>
	</TABLE2>
	<TABLE2>
		<TABLE2_LNR>2</TABLE2_LNR>
		<EL2>B</EL2>
	</TABLE2>
	<TABLE2>
		<TABLE2_LNR>3</TABLE2_LNR>
		<EL2>C</EL2>
	</TABLE2>
	<TABLE2>
		<TABLE2_LNR>4</TABLE2_LNR>
		<EL2>D</EL2>
	</TABLE2>
	<TABLE2>
		<TABLE2_LNR>5</TABLE2_LNR>
		<EL2>E</EL2>
	</TABLE2>
	<TABLE2>
		<TABLE2_LNR>6</TABLE2_LNR>
		<EL2>F</EL2>
	</TABLE2>
</ROOT>

The Stylesheet

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="*">
	<xsl:copy>
		<xsl:apply-templates select="*"/>
	</xsl:copy>
</xsl:template>
<xsl:template match="TABLE1/*[1]">
	<xsl:element name="TABLE1_LNR">
		<xsl:number count="TABLE1" level="single"/>
	</xsl:element>
	<xsl:copy>
		<xsl:apply-templates select="node()"/>
	</xsl:copy>
</xsl:template>
<xsl:template match="TABLE2/*[1]">
	<xsl:element name="TABLE2_LNR">
		<xsl:number count="TABLE2" level="single"/>
	</xsl:element>
	<xsl:copy>
		<xsl:apply-templates select="node()"/>
	</xsl:copy>
</xsl:template>
</xsl:stylesheet>

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.

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


Current Thread