[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Apostrification -- Re: Generating XPath expression
Richard The following from Francis Norton may be what you are looking for -- I couldn't find it in the archive -- hence the re-copy to the list All the best Charlie Charlie McCay, charlie@xxxxxxxxxxxxxxxxxxx > I'm trying to produce which is som debugging > message that generates and X-Path to the problem > > From: Francis Norton [mailto:francis@xxxxxxxxxxx] > Sent: 12 December 2000 14:17 > Subject: Re: Generating XPath expressions > > > Try this ... > > <xsl:template name="mypath"> > <xsl:for-each select="(ancestor-or-self::*|@*)"> > <xsl:choose> > <xsl:when test=". = /"/> > <xsl:otherwise>/<xsl:value-of select= > "concat(name(.), '[', > count(preceding-sibling::*[name(current()) = > name(.)]) + 1, ']')" > /> > </xsl:otherwise> > </xsl:choose> > </xsl:for-each> > </xsl:template> > > ... for an elements-only solution in XSLT, that generates > "/a[1]/b[3]/c[1]" style xpath for any given context node. > > Francis. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|