xsl-list
[Top] [All Lists]

Re: [xsl] xsl:value-of issue

2010-09-07 11:58:54
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


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