BizTalk Server General - XSLT

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > November 2005 > XSLT





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author XSLT
Nikki

2005-11-18, 5:52 pm

How can I use an XSLT call template to merge parent/child nodes; i.e.

IN:
<root>
<parent1>
<child>john</child>
</parent1>

<parent1>
<child>mary</child>
</parent1>

<parent2>
<child>jane</child>
</parent2>
</root>

GOAL:
<root>
<parent1>
<child>john</child>
<child>mary</child>
</parent1>
<parent2>
<child>jane</child>
</parent2>
</root>

your help is greatly appreciated.

THANKS!!
Alexandre Roba

2005-11-18, 5:52 pm

Hi Nikki,

Don't know if that was what you requested.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/root">
<root>
<xsl:attribute
name="xsi:noNamespaceSchemaLocation">//pdm/Users/arobadol/MYDOCU~1/ALTOVA~1/Root.xsd</xsl:attribute>
<parent1>
<xsl:for-each select="parent1">
<xsl:for-each select="child">
<child>
<xsl:value-of select="."/>
</child>
</xsl:for-each>
</xsl:for-each>
</parent1>
<parent2>
<xsl:for-each select="parent2">
<xsl:for-each select="child">
<child>
<xsl:value-of select="."/>
</child>
</xsl:for-each>
</xsl:for-each>
</parent2>
</root>
</xsl:template>
</xsl:stylesheet>

Regards,

Alexandre Roba


"Nikki" wrote:

> How can I use an XSLT call template to merge parent/child nodes; i.e.
>
> IN:
> <root>
> <parent1>
> <child>john</child>
> </parent1>
>
> <parent1>
> <child>mary</child>
> </parent1>
>
> <parent2>
> <child>jane</child>
> </parent2>
> </root>
>
> GOAL:
> <root>
> <parent1>
> <child>john</child>
> <child>mary</child>
> </parent1>
> <parent2>
> <child>jane</child>
> </parent2>
> </root>
>
> your help is greatly appreciated.
>
> THANKS!!

Nikki

2005-11-18, 5:52 pm

Alexandre,

thanks for the response. what's the systanx if the number of parent/child is
unknown?

"Alexandre Roba" wrote:
[vbcol=seagreen]
> Hi Nikki,
>
> Don't know if that was what you requested.
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs">
> <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
> <xsl:template match="/root">
> <root>
> <xsl:attribute
> name="xsi:noNamespaceSchemaLocation">//pdm/Users/arobadol/MYDOCU~1/ALTOVA~1/Root.xsd</xsl:attribute>
> <parent1>
> <xsl:for-each select="parent1">
> <xsl:for-each select="child">
> <child>
> <xsl:value-of select="."/>
> </child>
> </xsl:for-each>
> </xsl:for-each>
> </parent1>
> <parent2>
> <xsl:for-each select="parent2">
> <xsl:for-each select="child">
> <child>
> <xsl:value-of select="."/>
> </child>
> </xsl:for-each>
> </xsl:for-each>
> </parent2>
> </root>
> </xsl:template>
> </xsl:stylesheet>
>
> Regards,
>
> Alexandre Roba
>
>
> "Nikki" wrote:
>
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com