Altova Mailing List Archives


Re: That old chestnut - multiple XML into one XSL

From: "Jethro" <Jethro_uk@-------.--->
To: NULL
Date: 9/17/2004 11:46:00 AM
"Jonathan Chong" <jonathan@3...> wrote in message
news:e5cJjLKnEHA.340@t......
> Hi. I just did that recently with two XML. But I believe they should be
the
> same.
>
> /***********************This is the XSLT********************/
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
> <xsl:variable name="xml2" select="document('xml2.xml')"/>
> <xsl:variable name="xml3" select="document('xml3.xml')"/>
>
> <xsl:template match="/">
>     <xsl:apply-templates select="CONTACTS/CONTACT"/>
> </xsl:template>
>
> <xsl:template match="CONTACT">
>  <xsl:value-of select="name"/>
>  <xsl:apply-templates select="$xml2/PROPERTIES/PROPERTY"/>
> </xsl:template>
>
> <xsl:template match="PROPERTY">
>  <xsl:value-of select="name"/>
>  <xsl:apply-templates select="$xml3/IMAGES/IMAGE"/>
> </xsl:template>
>
> <xsl:template match="IMAGE">
>  <xsl:value-of select="name"/>
> </xsl:template>
>
> </xsl:stylesheet>
>
> /********************************First XML***************************/
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet type="text/xsl" href="3.xsl" ?>
> <CONTACTS>
> <CONTACT>
>  <name>contact 1</name>
> </CONTACT>
> </CONTACTS>
>
> /********************************Second XML***************************/
> <?xml version="1.0"?>
> <PROPERTIES>
>  <PROPERTY>
>   <name>property 1</name>
>  </PROPERTY>
>  </PROPERTIES>
>
> /********************************Third XML***************************/
> <?xml version="1.0"?>
> <IMAGES>
>  <IMAGE>
>   <name>image 1</name>
>  </IMAGE>
> </IMAGES>
>
> /********************************Result***************************/
> contact 1property 1image 1
>

thanks

I see the method, but I was hoping to find out how to do it without needing
a physical file. Isn't there a way I could just direct the XML streams into
the MSXML object ?

regards




Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.