Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] Rebuild XML file and merge

From: Robin La Fontaine <robin@--------.--->
To: Taco Fleur <taco@------.---.-->
Date: 8/1/2005 11:01:00 AM
Taco,

DeltaXML will do this for you by generating a delta file which is the 
two files in one, then you can decide how you want to merge them. It is 
a very simple XSL stylesheet to do this, only needing to read one file 
in. I can provide an example XSL for you. The structure of your files is 
maintained.

If you register at www.deltaxml.com you have access to DeltaNet test 
drive that will allow you do upload your files and then download the 
delta, so you do not need to install any software, and if your files are 
smallish it is free (or if they are large the download software is free 
for evaluation for a couple of weeks)!

Let me know offline if I can help further with this.

Best regards,
Robin

Taco Fleur wrote:
> Hi all..
> 
>  
> 
> I am trying to rebuild an XML file and merge it, I am having some 
> difficulty getting the XSL right.
> 
>  
> 
> I need to maintain the structure of the original XML file I feed to this 
> transformation, but when I come to the element &#x201C;field&#x201D; I need to merge 
> the elements from the $fieldCollection variable and have any attributes 
> overwritten in the original file by $fieldcollection. Below is what I 
> have been able to pull together, but obviously its not working. Any help 
> is very much appreciated.
> 
>  
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet
>      version="1.0"
>      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
>      <xsl:output
>           omit-xml-declaration="yes"
>           indent="yes"
>           media-type="string" />
> 
>      <xsl:variable
>           name="fieldCollection"
>       
>     select="document('C:\Inetpub\wwwroot\development\shelco_company_registration_form\xml\field.xml')/root"/>
> 
>      <xsl:template match="/">
>           <xsl:apply-templates />
>      </xsl:template>
> 
>      <xsl:template match="*">
>           <xsl:if test="name() = 'field'">
>                <testing />
>                     <xsl:apply-templates ***** call the field template!! 
> ***** />
>           </xsl:if>
>           <xsl:element name="{name()}">
>                <xsl:for-each select="@*">
>                     <xsl:attribute name="{name()}">
>                          <xsl:value-of select="."/>
>                     </xsl:attribute>
>                </xsl:for-each>
>                <xsl:apply-templates />
>           </xsl:element>
>      </xsl:template>
> 
>      <xsl:template match="field">
>                <xsl:copy>
>                     <xsl:copy-of select="@*" />
>                     <xsl:copy-of select="$fieldCollection/field[ 
> current()/@identity = @identity ]/@*" />
>                     <xsl:element name="$fieldCollection/field[ 
> current()/@identity = @identity ]/*">
>                          <xsl:copy-of select="$fieldCollection/field[ 
> current()/@identity = @identity ]/*" />
>                     </xsl:element>
>                </xsl:copy>
>      </xsl:template>
> 
> </xsl:stylesheet>
> 
>  
> 
> ________________________________
> 
> Taco Fleur - /E-commerce Development Manager/
> 
> Shelco Searches & Services
> 
> An Authorised ASIC Information Broker
> 
> www.shelco.com.au
> 
> Ph: + 61 7 3236 2605
> 
>  
> 

-- 
-- ---------------------------------------------------
Robin La Fontaine    DeltaXML: "Change control for XML, in XML"
Email: robin@d...      http://www.deltaxml.com
Free XML comparison service http://compare.deltaxml.com


transparent
Print
Mail
Like It
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.

.
.

transparent

transparent