Re: [xsl] Transform some attributes into HTML span elements with delimiters (specific format)

Subject: Re: [xsl] Transform some attributes into HTML span elements with delimiters (specific format)
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Thu, 27 May 2010 15:12:20 -0700 (PDT)
Mukul Gandhi wrote:

  Hi,

> I think, I would have done this as following:

>
<xsl:template match="InspectionReportInput">
>   <span
id="firstName"><xsl:value-of select="@firstName"
> /></span> <span
id="lastName"><xsl:value-of select="@lastName"
>
/><xs:text>, </xsl:text><xsl:value-of select="@city" />
> </xsl:template>

  I
am always surprised to see that many people try very hard to
be "more
concise", even when that ends up less readable.  Why not
simply that?:
<!--
        Format an inspection report element by using the
appropriate SPAN elements and text separators.
    -->
    <xsl:template
match="InspectionReportInput">
       <span id="firstName">
<xsl:value-of select="@firstName"/>
       </span>
       <xsl:text>
</xsl:text>
       <span id="lastName">
          <xsl:value-of
select="@lastName"/>
       </span>
       <xs:text>, </xsl:text>
       <span
id="city">
          <xsl:value-of select="@city"/>
       </span>
</xsl:template>

  Regards,

-- 
Florent Georges
http://fgeorges.org/

Current Thread