OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Rebuild XML file and merge

[ Lists Home | Date Index | Thread Index ]
  • To: <xml-dev@lists.xml.org>
  • Subject: Rebuild XML file and merge
  • From: "Taco Fleur" <taco@shelco.com.au>
  • Date: Fri, 22 Jul 2005 13:17:17 +1000
  • Thread-index: AcWOa915VAXxbuJuRPe6RKJGUIjHaw==
  • Thread-topic: Rebuild XML file and merge

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 “field” 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"?>

          media-type="string" />


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

     <xsl:template match="*">
          <xsl:if test="name() = 'field'">
               <testing />
                    <xsl:apply-templates ***** call the field template!! ***** />
          <xsl:element name="{name()}">
               <xsl:for-each select="@*">
                    <xsl:attribute name="{name()}">
                         <xsl:value-of select="."/>
               <xsl:apply-templates />

     <xsl:template match="field">
                    <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 ]/*" />




Taco Fleur - E-commerce Development Manager

Shelco Searches & Services

An Authorised ASIC Information Broker


Ph: + 61 7 3236 2605



News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS