Re: [xsl] Path according to a child node attribute

Subject: Re: [xsl] Path according to a child node attribute
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 02 Jan 2012 13:08:21 +0100
Gian Paolo Bernardini wrote:

	<Class code="B">
		<SubClass code="b1"/>
		<SubClass code="b2"/>
		<Rubric kind="preferred">
			<Label xml:lang="it">FUNZIONI CORPOREE</Label>
			<Label xml:lang="en">BODY FUNCTIONS</Label>
		</Rubric>
		<Rubric kind="definition">
			<Label xml:lang="it">Le funzioni corporee sono
..</Label>
			<Label xml:lang="en">Body functions ...</Label>
		</Rubric>
	</Class>

The aim is the same, now it must be chosen the text inside the<Label
xml:lang="it">  inside<Rubric kind="preferred">  since there are more kind
attributes for<Rubric>  element.

    <xsl:template match="Class" mode="path">
      <xsl:variable name="next" select="key('k1', SuperClass/@code)"/>
      <xsl:if test="$next">
        <xsl:apply-templates select="$next" mode="path"/>
        <xsl:text>/</xsl:text>
      </xsl:if>
      <xsl:value-of select="concat(@code,' ', Rubric)"/>
    </xsl:template>

You just need to change the
<xsl:value-of select="concat(@code,' ', Rubric)"/>
to
<xsl:value-of select="concat(@code,' ', Rubric[@kind = 'preferred']/Label[lang('it')])"/>



--


	Martin Honnen --- MVP Data Platform Development
	http://msmvps.com/blogs/martin_honnen/

Current Thread