Re: [xsl] InnerElement attribute needs to be set for parent

Subject: Re: [xsl] InnerElement attribute needs to be set for parent
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Sat, 10 May 2008 19:41:19 +0530
I din't know the reasons why Martin choose the code fragments below,
as opposed to what I wrote. But in fact I think Martin's logic is
better than mine (please see below why I think so):

On 5/10/08, Martin Honnen <Martin.Honnen@xxxxxx> wrote:
>  <xsl:template match="propertyList">
>    <xsl:copy>
>      <xsl:apply-templates select="property"/>
>    </xsl:copy>
>  </xsl:template>

This is better, because inside the template body there is no hard
coding of the 'propertyList' element. If the element name changes,
it's required to change the name at only one place (at the match
pattern).

My logic mentioned the element name in the template body, as well.

>
>  <xsl:template match="property">
>    <xsl:attribute name="{@name}">
>      <xsl:value-of select="@value"/>
>    </xsl:attribute>
>  </xsl:template>

Martin's code is more aligned with the spirit of XSLT, but I thought
more procedural like.

But I do not dislike my logic :)


-- 
Regards,
Mukul Gandhi

Current Thread