Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

tricky xsl transformation needed...

Question posted by: stefan.oedenkoven@googlemail.com (Guest) on June 27th, 2008 07:07 PM
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?

Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Martin Honnen's Avatar
Martin Honnen
Guest
n/a Posts
June 27th, 2008
07:07 PM
#2

Re: tricky xsl transformation needed...
Join Bytes! wrote:
Quote:
Originally Posted by
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:stylesheet
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="normalize-space(.)"/>
</a>
</xsl:template>

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

</xsl:stylesheet>


--

Martin Honnen
http://JavaScript.FAQTs.com/

stefan.oedenkoven@googlemail.com's Avatar
stefan.oedenkoven@googlemail.com
Guest
n/a Posts
June 27th, 2008
07:07 PM
#3

Re: tricky xsl transformation needed...
Hi Martin,

thanks a lot...!!!

//stefan

 
Not the answer you were looking for? Post your question . . .
184,043 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors