This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How can I get the position of an element that has a descendant 'y' with value 'z' ?



  Please try the following stylesheet.  I think it can be tuned,
  but works..

<?xml version="1.0" standalone="yes"?> 
<xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xsl:version="1.0">
<xsl:output method="text"/>

<xsl:template match="element">
  <xsl:if test=".//y"> 
    <xsl:variable name="yvalue"><xsl:value-of select=".//y"/></xsl:variable>
     <xsl:if test="$yvalue = 'z'">
       <xsl:number count="element" format="1" level="any"/>
     </xsl:if>
  </xsl:if>
</xsl:template>
</xsl:stylesheet>




>>Date: Thu, 3 Feb 2000 17:05:46 -0500
>>From: "mohamed" <mohamed@b-bop.com>
>>Subject: How can I get the position of an element that has a descendant
'y' with >>value 'z' ?

>>This is a multi-part message in MIME format.

>>- ------=_NextPart_000_05E9_01BF6E68.E9789070
>>Content-Type: text/plain;
>>	charset="iso-8859-1"
>>Content-Transfer-Encoding: quoted-printable

>>Hi
>>How can I get the position of an element that has a descendant 'y' with =
>>value 'z' ?

>><?xml version=3D"1.0"?>
>><elementList>
>>    <element>
>>        <x>
>>            <y>a</y>
>>        </x>
>>    </element>
>>    <element>
>>        <x>
>>            <y>z</y>
>>        </x>
>>    </element>
>></elementList>


----------------------------------------------------------------------------
---------
Senthil Vaiyapuri
408-572-3224
Portal Software


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]