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

problem with node-set pattern

Subject: problem with node-set pattern
From: Michael Schäfer <MSchaefer@xxxxxxxxxxxx>
Date: Fri, 6 Jul 2001 13:54:49 +0200
node set pattern
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

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.