xsl-list
[Top] [All Lists]

SV: [xsl] XML Question

2006-10-04 04:18:55
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(_dot_)linke(_at_)linke(_dot_)de> 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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>