[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XML Question

Subject: RE: XML Question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 4 Oct 2006 12:22:55 +0100
RE:  XML Question
The name() function takes a single node as its argument, not a list of
nodes.

Change name(ancestor::*) to ancestor::*/name()

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Per Osnes [mailto:per.osnes@xxxxxx] 
> Sent: 04 October 2006 12:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: SV:  XML Question
> 
> Hi folks,
> This template gives the required output (in Altova).
> 
> <xsl:template match="//*[not(*)]">
> <xsl:variable name="path">
> <xsl:for-each select="ancestor::*"><xsl:value-of
> select="name()"/>/</xsl:for-each>
> <xsl:value-of select="name()"/>
> </xsl:variable>
> <xsl:text>
> </xsl:text>
> <xsl:value-of select="$path"/>
> <xsl:value-of select="' ===> '"/>
> <xsl:value-of select="text()"/>
> </xsl:template>
> 
> Actually I wanted to replace the "for each" by something like
>   <xsl:value-of select="string-join(((name(ancestor::*)), 
> name()), '/')"/>
> 
> but Altova gives error message "too many items"...
> I have used this method earlier for producing the full path 
> for elements in an XML schema:
>   select="string-join((ancestor::xs:element/@name, ./@name), '.')"
> 
> Any comments from the experts?
> 
>  - Per Osnes.
> 
> 
> ----- LINKE Markus <markus.linke@xxxxxxxx> wrote:
> > Hi,
> > 
> > I am not sure if this is the right list for such a 
> question, but lets 
> > try :)
> > 
> > I would like to create a list of xpaths via xsl from a given 
> > xml-structure like this:
> > 
> > <a>
> >    <b>
> >       <c>
> >          content
> >       </c>
> >       <d>
> >          morecontent
> >       </d>
> >    </b>
> > </a>
> > 
> > it should show the full xpath like
> > 
> > a/b/c  ====>   content
> > a/b/d  ====>   morecontent
> > 
> > and not just
> > 
> > c => content
> > d => morecontent
> > 
> > Ideas anyone? I am looking for either a script or some xsl ...
> > 
> > Cheers,
> > Markus

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.