Re: [xsl] dynamic node access

Subject: Re: [xsl] dynamic node access
From: RQamar <qamar_rahil@xxxxxxxxxxx>
Date: Mon, 21 Feb 2005 15:24:49 +0000
David Carlisle wrote:

So how can I create the element <SubConcepts> below <Top> and not <PrimeConcept> ?

just move it there in the stylesheet, what's the problem?

The problem lies in that a <SubConcepts> node is created only if there exists some 'Toyota'. So I've created the <SubConcepts> node dynamically inside the <xsl:template> of the <PrimeConcept> node. A simple <xsl:element name='SubConcepts'> within this template automatically places it as a child of <PrimeConcept>. However I want <SubConcepts> to be the child of <Top> even though its being created inside the <PrimeConcept> template.


<xsl:element name="SubConcept">
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>

is a very long way of writing

<SubConcept id="{@id}" name="{@name"/>

This looks neat. Will refine my code. Thanks


Current Thread