RE: [xsl] xsl:value-of issue

Subject: RE: [xsl] xsl:value-of issue
From: "Etheridge, Stephen" <stephen.etheridge@xxxxxxxxxx>
Date: Wed, 8 Sep 2010 08:58:35 +0100
Not thinking too simply Chris, I was thinking in too complicated a
fashion!  Thanks.

Kind regards
Stephen

-----Original Message-----
From: Christian Roth [mailto:roth@xxxxxxxxxxxxxx]
Sent: 07 September 2010 17:59
To: XSL List
Subject: Re: [xsl] xsl:value-of issue

Etheridge, Stephen wrote:

>Source:
>
><MilkList>A value</MilkList>
><MilkListLocalVal>Another value</ MilkListLocalVal>
>
>Desired output:
><MilkList>Another value</MilkList>

I think your logic is a complicated approach. Isn't your desired output
the same as saying

"Discard all *List elements and rename any *ListLocalVal elements to
*List elements."

?

That would then be

<xsl:template name="process-list">
  <xsl:choose>
    <xsl:when test="ends-with( local-name(), 'ListLocalVal')">
      <xsl:element name="{substring-before(local-name(), 'LocalVal')}">
        <xsl:apply-templates />
      </xsl:element>
    </xsl:when>
    <xsl:otherwise>
      <!-- discard the element: do nothing here -->
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Am I thinking too simple?

-chris



Please help Logica to respect the environment by not printing this email  /
Pour contribuer comme Logica au respect de l'environnement, merci de ne pas
imprimer ce mail /  Bitte drucken Sie diese Nachricht nicht aus und helfen Sie
so Logica dabei, die Umwelt zu sch|tzen. /  Por favor ajude a Logica a
respeitar o ambiente nao imprimindo este correio electronico.



This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.

Current Thread