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

Re:Re:in for-each: absolut position

Subject: Re:Re:in for-each: absolut position
From: "Yang" <sfyang@xxxxxxxxxxxxx>
Date: Fri, 21 Sep 2001 19:39:43 +0800
absolut template
Hi,   Jochen:

I use <xsl:number> element to print out the absolute postion in
the document file.

>A good idea is to use "::" in the concat.

The reason using '::'' in the concat is to avoid possible collision to node
name inside of xml documentation,
you can check jeni site about this.

I try to keep your xslt inattack as much as possible,  so I remove
<xsl:if> element in the second template since it is redundant to one of
conditions of the first template.

I add the the third template to get each  absolute position print and
with mode **zeile** to distinguish it from the second template.

A revised xslt list is attached for your reference.

I hope someone in this list could provide u a better solution.

Cheers,

Sun-fu Yang

sfyang@xxxxxxxxxxxxx
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40">
  <xsl:output method="html" />
  <xsl:strip-space elements="*" />
  <xsl:key name="rowkey" match="row" use="concat(@name0,'::',@name1)" />
- <xsl:template match="/gentable">
  <xsl:apply-templates select="//row[generate-id(.) =
generate-id(key('rowkey',concat(@name0,'::'@name1))[1])
 and count(key('rowkey',concat(@name0,'::',@name1)))>1]" />
  </xsl:template>
- <xsl:template match="row">
  <xsl:variable name="v_name0" select="@name0" />
  <xsl:variable name="v_name1" select="@name1" />
  <xsl:variable name="keys"
select="key('rowkey',concat(@name0,'::',@name1))" />
  <xsl:variable name="anzahl" select="count($keys)" />
  Eintrag '
  <xsl:value-of select="@name0" />
  ,
  <xsl:value-of select="@name1" />
  ' ist
  <xsl:value-of select="$anzahl" />
  -fach definiert. Zeile
  <xsl:apply-templates select="$keys" mode="zeile" />
  </xsl:template>
- <xsl:template match="row" mode="zeile">
- <!--    get line number on the document file
  -->
  <xsl:number />
- <xsl:if test="position()!=last()">
  <xsl:text>;</xsl:text>
  </xsl:if>
  </xsl:template>
  </xsl:stylesheet>


 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.