Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: AW: XML transformation with changed XSD

From: George Cristian Bina <george@---------.--->
To: Udo Ende <u.ende@---.-->
Date: 2/20/2006 4:30:00 PM
Hi Udo,

If you want to add something you just emit that in the place you want it 
added. If you want to delete something just exclude that from your 
processing (do not copy that to the output).

Here it is an example that changes element a in b, adds an attribute 
newAtt to the new b element and deletes an attribute toBeRemoved if it 
is present on the a element:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0">
   <xsl:template match="node() | @*">
     <xsl:copy>
       <xsl:apply-templates select="node() | @*"/>
     </xsl:copy>
   </xsl:template>
   <xsl:template match="a">
     <b newAtt="1">
      <xsl:apply-templates select="@*[not(name()='toBeRemoved')]"/>
       <xsl:apply-templates select="node()"/>
     </b>
   </xsl:template>
</xsl:stylesheet>

On a document like:
<?xml version="1.0" encoding="UTF-8"?>
<test>
   <a toBeRemoved="1">
     <id>i1</id>
   </a>
</test>

will give:

<?xml version="1.0" encoding="UTF-8"?><test>
   <b newAtt="1">
     <id>i1</id>
   </b>
</test>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com


Udo Ende wrote:
> 
> Thanks Michael and George for your answers.
> 
> I tested some things, but could not find out if I can insert and delete=
. I
> haven't found something within the Oxygen XML Editor, and I do not want=
 to
> ask for another trial version of stylus studio if I am not sure, it hel=
ps
> with that.
> 
> Udo
> 
> -----Urspr=FCngliche Nachricht-----
> Von: Michael Kay [mailto:mike@s...] 
> Gesendet: Freitag, 17. Februar 2006 11:00
> An: 'Udo Ende'; 'Xmlschema-Dev-Request'
> Betreff: RE: XML transformation with changed XSD
> 
>> I have a set of XML files being (correctly) validated to a 
>> XSD file. Now I
>> upgrade the XSD file and therefore I have to change the XML files.
>>
>> What is the best way to automate the transformation of the 
>> XML files? Are
>> there any tools that can do that?
> 
> Clearly the process can't be automated. But the visual mapping tools in
> products like Stylus Studio, where you define the input and output sche=
mas
> and then generate an XSLT transformation by drawing lines from one to t=
he
> other, work particularly well when the two schemas are very similar.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> 
> 
> 
> 

From george@o... Mon Feb 20 17:40:01 2006
Received: from lisa.w3.org ([128.30.52.41])
	by frink.w3.org with esmtp (


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