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: xpath expression


Rather than matching on <type> directly, I think you are better 
off matching each <input> and from there looking forward or backward 
to the next or previous <input>. If you really must match on each
<type>, you can reach the parent <input> by simply adding "../" 
to the head of the XPath expression.

Regards,

Dan

-------------------
<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
   
 <xsl:output indent="yes"/>

 <xsl:template match="/">
  <xsl:apply-templates select="root"/>
 </xsl:template>

 <xsl:template match="root">
  <xsl:apply-templates select="input"/>
 </xsl:template>

 <xsl:template match="input">
  Preceding input=<xsl:value-of
select="preceding-sibling::input[1]/type"/><br/>
  This input=<xsl:value-of select="type"/><br/>
  Following input=<xsl:value-of
select="following-sibling::input[1]/type"/><br/>
  <hr/>
 </xsl:template>

</xsl:stylesheet>



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

 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]