get parent information

Hi,

I am starting in XSLT and I struggle against converting imbricated data into a flat model (that is not really XML compliant).

here is an extract of the XML source:







Here is what I need to get:

category1category2


name of resource


http://www.test.com


I do not understand how to get the categories.

Thanks a lot for all your suggestions.

Maxime

This comes close to what you want:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="/">
<path><xsl:apply-templates select="outline"/></path>
<xsl:apply-templates select="//outline[@title]" mode="res"/>
</xsl:template>

<xsl:template match="outline[@type]">
<d></d><xsl:value-of select="@type"/>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="outline"/>

<xsl:template match="outline" mode="res">
<name><xsl:value-of select="@title"/></name>
<URL><xsl:value-of select="@URL"/></URL>
</xsl:template>

</xsl:stylesheet>

Hi

assume your document looks as follows (just wrapped with ):


category1category2
name of resource
http://www.test.com


The result when using the following stylesheet

<xsl:stylesheet xmlns:xsl=“XSLT Namespace” version=“1.0”>
<xsl:template match=“/root”>
<xsl:apply-templates select=“path/text()”/>
</xsl:template>
<xsl:template match=“text()”>
text(): <xsl:value-of select=“position()”/>. “<xsl:value-of select=”.“/>”
</xsl:template>
</xsl:stylesheet>

is

text(): 1. “category1”

text(): 2. “category2”

Cheers
Uli