Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 3rd, 2006, 08:13 AM
Authorized User
 
Join Date: Jun 2005
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rajatake
Default Basic doubt in combining XML Documents

Hi,

 I am combining multiple XML documents in to one XML documents. The following is my XML file structure.

<component>

<structure>
<section>
<id root="037d359d-d903"/>
<code code="306-1" codeSystem="2.61"/>
</section>
</structure>

<structure>
<section>
<id root="037d359d-d503"/>
<code code="340-1" codeSystem="2.16"/>
</section>
</structure>

</component>

if i run the .xsl the whole <component> to </component> should be copied with XML strucure

my xsl is as follows:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" omit-xml-declaration="no" encoding="UTF-8"/>

<xsl:template match="/">
<xsl:for-each select="index/file">
       <xsl:apply-templates select="document(@filename)/component"/>
     </xsl:for-each>
</xsl:template>

<xsl:template match="component">
<section>
<xsl:apply-templates/>
</section>
</xsl:template>

</xsl:stylesheet>



but if i run the above .xsl, nothing happened. Please help me.

Thanks in advance.
N.Raja



 
Old May 4th, 2006, 12:11 AM
Authorized User
 
Join Date: Apr 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to vakorde
Default

I doubt if you can create a file through the XSL transformation. Yes you can convert one XML in another XML but the converted XML has to be stored by a serverside language. does this gives you an answer?

Rather i am not clear with your question.

---------------------------
Vikrant Korde
3i Infotech, Vashi,
Mumbai, Maharashtra, India.
 
Old May 4th, 2006, 04:30 AM
Authorized User
 
Join Date: Jun 2005
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rajatake
Default

i got the answer. its working fine now.

the correct .xsl is

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" omit-xml-declaration="no" encoding="UTF-8"/>

<xsl:template match="/">
<xsl:for-each select="index/file">
       <xsl:apply-templates select="document(@filename)/component"/>
     </xsl:for-each>
</xsl:template>


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

</xsl:stylesheet>

Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining string paths elements into another XML eXhumed XSLT 2 March 19th, 2008 11:06 AM
compare two xml documents bcogney XSLT 1 October 30th, 2006 03:33 PM
JDOM Combining two XML documents Clone help [email protected] XML 2 July 25th, 2006 06:01 PM
beginners problems (combining xml feeds etc) bewise XSLT 0 February 7th, 2006 06:39 AM
merge 2 xml documents Beulah VS.NET 2002/2003 0 November 20th, 2003 09:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.