Re: [xsl] xsl unique position

Subject: Re: [xsl] xsl unique position
From: Steven.C.Kienle@xxxxxxxxxx
Date: Fri, 9 Mar 2001 08:37:29 -0500
  You are getting 1 for the position() each time because Jack and Jill 
  are both the first Name in the list of Names for each Member.  That 
  is, position is not file dependent, but node-list dependent.  Since 
  you apply-templates for Name under each Member, you end up with a 
  different node-list each time.
  <Group>           <!-- position() = 1 -->
  <Member>          <!-- position() = 1 within /Group/Member -->
  <Name>Jack</Name> <!-- position() = 1 within member[1] -->
  <Member>          <!-- position() = 2 within /Group/Member -->
  <Name>Jill</Name> <!-- position() = 1 within member[2] -->
  It seems like what you really want is to use the "/Group/Member 
  position" for identifying the Name.  In that case, you can replace the 
  <xsl:apply-templates select="*"/> in your Member template with the 
     <xsl:element name="input">
     <xsl:attribute name="type">text</xsl:attribute>
     <xsl:attribute name="name">Name<xsl:value-of
     <xsl:attribute name="value">
     <xsl:value-of select="Name"/>
  I am assuming you will have only one Name element under each Member 
  element here.  In that case, you don't really need to call 
  apply-templates.  If you may have more than one Name element under 
  each Member, you may need to pass the Member position() as a parameter 
  to the Name template to support uniqueness.

______________________________ Reply Separator _________________________________
Subject: [xsl] xsl unique position
Author:  mat t <mat@xxxxxxxxxx> at Internet-America
Date:    09-03-2001 5:01 AM

Please can you help:
I am losing the variable due to duplication
<xsl:template match="/">
   <xsl:apply-templates select="Group/Member"/>
<xsl:template match="Member">
 <xsl:apply-templates select="*"/>
 <xsl:element name="input">
  <xsl:attribute name="type">hidden</xsl:attribute> 
  <xsl:attribute name="name">Member<xsl:value-of
select="position()"/><xsl:value-of select="position()"/></xsl:attribute>
  <xsl:attribute name="value"></xsl:attribute> 
<xsl:template match="Name">
 <xsl:element name="input">
  <xsl:attribute name="type">text</xsl:attribute> 
  <xsl:attribute name="name">Name<xsl:value-of
  <xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute>
The variables sent are -
Member1 =>
Name1 => Jack
Unfortunately I don't get the second name. I assume that Name1 means 
it's position 1 in parent node "Member"
Which means that the second name will also have name1 as it's name and 
the form has ignored it thinking it's a duplicate.
Please can you tell me if there is any way to solve this problem.
Pick up your email anywhere in the world --->
 XSL-List info and archive:

 XSL-List info and archive:

Current Thread