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

Re: in for-each apply-templates doesnot work

Subject: Re: in for-each apply-templates doesnot work
From: "Jochen Herrmann" <jochen.herrmann@xxxxxxxx>
Date: Wed, 19 Sep 2001 10:44:39 +0200
data72
Hi Mike,
thank you very much, these have been the good hints:

  <xsl:strip-space elements="*"/>
 <xsl:variable name="pos2"
select="count(following-sibling::row[@name0=$v_name0 and
@name1=$v_name1]/preceding-sibling::*)+1"/>

pleas notice, you need "+1" at the end.
Thanks and By
Jochen

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<?xml:stylesheet type="text/xsl" href="test2_mail.xsl" ?>
<gentable xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="test2.xsd">
  <header colname0="name0" colname1="name1" colname2="name2"
colname3="name3" colname4="name4" colname5="name5" colname6="name6"
colname7="name7" colname8="name8" colname9="VERSION_ID"/>
  <body>
    <row name0="data0"  name1="data1"  name2="data2"  name3="data3" 
name4="data4"  name5="data5"  name6="data6"  name7="data7" 
name8="data8"  VERSION_ID="9" />
    <row name0="data0"  name1="data1"  name2="data2"  name3="data3" 
name4="data4"  name5="data5"  name6="data6"  name7="data7" 
name8="data8"  VERSION_ID="9" />
    <row name0="data9"  name1="data10"  name2="data11"  name3="data12" 
name4="data13"  name5="data14"  name6="data15"  name7="data16" 
name8="data17"  VERSION_ID="9" />
    <row name0="data18"  name1="data19"  name2="data20"  name3="data21" 
name4="data22"  name5="data23"  name6="data24"  name7="data25" 
name8="data26"  VERSION_ID="9" />
    <row name0="data27"  name1="data28"  name2="data29"  name3="data30" 
name4="data31"  name5="data32"  name6="data33"  name7="data34" 
name8="data35"  VERSION_ID="9" />
    <row name0="data36"  name1="data37"  name2="data38"  name3="data39" 
name4="data40"  name5="data41"  name6="data42"  name7="data43" 
name8="data44"  VERSION_ID="9" />
    <row name0="data45"  name1="data46"  name2="data47"  name3="data48" 
name4="data49"  name5="data50"  name6="data51"  name7="data52" 
name8="data53"  VERSION_ID="9" />
    <row name0="data54"  name1="data55"  name2="*"  name3="data57" 
name4="data58"  name5="data59"  name6="data60"  name7="data61" 
name8="data62"  VERSION_ID="9" />
    <row name0="data63"  name1="data64"  name2=""  name3="data66" 
name4="data67"  name5="data68"  name6="data69"  name7="data70" 
name8="data71"  VERSION_ID="9" />
    <row name0="data72"  name1="data73"  name2="data74"  name3="data75" 
name4="data76"  name5="data77"  name6="data78"  name7="data79" 
name8="data80"  VERSION_ID="9" />
    <row name0="data81"  name1="data82"  name2="data83"  name3="data84" 
name4="data85"  name5="data86"  name6="data87"  name7="data88" 
name8="data89"  VERSION_ID="9" />
    <row name0="data72"  name1="data73"  name2="data747" 
name3="data75"  name4="data76"  name5="data77"  name6="data78" 
name7="data79"  name8="data80"  VERSION_ID="9" />
    <row name0="data72"  name1="data73"  name2="data747" 
name3="data75"  name4="data76"  name5="data77"  name6="data78" 
name7="data79"  name8="data80"  VERSION_ID="9" />
  </body>
</gentable>


----- test2_mail.xsl ------

<?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:template match="/gentable">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="row">
    <xsl:variable name="v_name0" select="@name0"/>
    <xsl:variable name="v_name1" select="@name1"/>
    <xsl:variable name="pos1" select="position()"/>
    <xsl:variable name="pos2"
select="count(following-sibling::row[@name0=$v_name0 and
@name1=$v_name1]/preceding-sibling::*)+1"/>

    <xsl:if test="$pos2!=1 and $pos1!=$pos2">
          Eintrag '<xsl:apply-templates select="@name0" />' ist doppelt
definiert. Zeilen <xsl:value-of select="$pos1"/> und <xsl:value-of
select="$pos2"/>
    </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.