OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] How to get XPath in a XSLT shylesheet

Long JingJun wrote:
> Hi all,
> My original target is to get the XPath to identify the location of an element in the XML output (as location attribute for an example). So that I can find the original place in the source file when I go through the generated XML output. What I mean full XPath is like this: /document/chapter[2]/section[3]/subject[1]/para[2]
> Thanks all. You answered my question.
Heres the code we use in Schematron (I think from David Carlisle 

          <xsl:template match="*|@*" mode="get-full-path">

            <xsl:apply-templates select="parent::*" mode="get-full-path"/>
            <xsl:if test="count(. | ../@*) = count(../@*)">@</xsl:if>
            <xsl:value-of select="name()"/>

(XSLT question are better dealt with on the mulberry XSLT list.)

Rick Jelliffe

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS