This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xpath expression
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] xpath expression
- From: Dan Diebolt <dandiebolt at yahoo dot com>
- Date: Thu, 17 May 2001 19:05:23 -0700 (PDT)
- Reply-To: xsl-list at lists dot mulberrytech dot com
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