xsl-list
[Top] [All Lists]

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

2012-01-02 06:08:35
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/

--~------------------------------------------------------------------
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>