tricky xsl transformation needed...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • stefan.oedenkoven@googlemail.com

    tricky xsl transformation needed...

    Hi ng,

    how can i transform this source-xml in the target xml? is it possible
    to get <a>Ax</aenclosed?

    source-xml:
    <z>
    A1
    <b>B1</b>
    A2
    </z>


    desired target-xml:
    <z>
    <a>A1</a>
    <b>B1</b>
    <a>A2</a>
    </z>


    ....anyone?

  • Martin Honnen

    #2
    Re: tricky xsl transformation needed...

    stefan.oedenkov en@googlemail.c om wrote:
    how can i transform this source-xml in the target xml? is it possible
    to get <a>Ax</aenclosed?
    >
    source-xml:
    <z>
    A1
    <b>B1</b>
    A2
    </z>
    >
    >
    desired target-xml:
    <z>
    <a>A1</a>
    <b>B1</b>
    <a>A2</a>
    </z>
    <xsl:styleshe et
    xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
    version="1.0">

    <xsl:output method="xml" indent="yes"/>

    <xsl:template match="z/text()[starts-with(normalize-space(.), 'A')]">
    <a>
    <xsl:value-of select="normali ze-space(.)"/>
    </a>
    </xsl:template>

    <xsl:template match="@* | node()">
    <xsl:copy>
    <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
    </xsl:template>

    </xsl:stylesheet>


    --

    Martin Honnen

    Comment

    • stefan.oedenkoven@googlemail.com

      #3
      Re: tricky xsl transformation needed...

      Hi Martin,

      thanks a lot...!!!

      //stefan

      Comment

      Working...