Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 10th, 2008, 01:44 AM
Authorized User
 
Join Date: Nov 2008
Location: Chennai, Tamil Nadu, India.
Posts: 12
Thanks: 2
Thanked 1 Time in 1 Post
Send a message via Yahoo to mail4kaja
Default Transforming XML From One Namespace to Another

Hello everyone...

I'm trying to develop a system where all the configurations are saved as XML Files in Oracle XMLDB. We have own namespace for configuration. Oracle XMLDB provides a namespace XDIff through which I can specify what are the changes to be done in the XML, so that those changes will be updated in the database. But, the changes done in the configuration is coming as an Update XML file (in different namespace). I need to transform it to Oracle's XDiff namespace.

Example:
Configuration File:

<Configuration>
<Header>Some Info About Config</Header>
<ConfigItem1 attribute1="something">
<SubConfig11>1<SubConfig11>
<SubConfig12>2</SubConfig12>
</ConfigItem1>
<ConfigItem2 attribute2="something">1</ConfigItem2>
<ConfigItem3 attribute3="something">1</ConfigItem3>
</Configuration>

As you have seen, the configuration has some nested items too. The Update XML looks like:
<Configuration>
<ConfigItem1 attribute1="newthing" modifier="new">3</ConfigItem1>
<ConfigItem1 attribute1="something">
<SubConfig11 modifier="delete"/>
<SubConfig12 modifier="update">1</SubConfig12>
</ConfigItem1>
<ConfigItem2 attribute="something" modifier="update">
<SubConfig21>0</SubConfig21>
<SubConfig22>1</SubConfig21>
</ConfigItem2>
</Configuration>

The above Update XML means that
  • A ConfigItem1 with attribute1 as "newthing" has to be created - Its text value is 3
  • The SubConfig11 under ConfigItem1[@attribute1="something"] has to be deleted
  • The SubConfig12 has to be updated with text value 1
  • Update ConfigItem2 with 2 childs
The expected XDiff document for performing this update in Oracle is
<xd:xdiff xsi:schemaLocation="http://xmlns.oracle.com/xdb/xdiff.xsd http://xmlns.oracle.com/xdb/xdiff.xsd">
<?oracle-xmldiff operations-in-docorder="false" output-model="current" diff-algorithm="global"?>
<xd:append-node xd:node-type="element" xd:xpath="/Configuration/ConfigItem1">
<xd:content>
<ConfigItem1 attribute1="newthing">3</ConfigItem1>
</xd:content>
</xd:append-node>
<xd:delete-node xd:node-type="element" xd:xpath="/Configuration/ConfigItem1[@attribute1=something]/SubConfig11"/>
<xd:update-node xd:node-type="text" xd:xpath="/Configuration/ConfigItem1[@attribute=something]/SubConfig12">
<xd:content>
1
</xd:content>
</xd:update-node>
<xd:update-node xd:node-type="element" xd:xpath="/Configuration/ConfigItem2[@attribute2=something]">
<xd:content>
<SubConfig21>0</SubConfig21>
<SubConfig22>1</SubConfig21>
</xd:content>
</xd:update-node>
</xd:xdiff>


Please help me transforming the Update XML to XDiff Namespace.

I face difficulties in getting the XPath with predicates :-(

Also, I have to use xd:node-type as text when the text value of node is getting updated, or its value is element when it has child nodes.

Thanks in advance

R Kaja Mohideen
http://www.vhost4all.com/
__________________
R Kaja Mohideen
http://www.vhost4all.com/
Reply With Quote
  #2 (permalink)  
Old November 10th, 2008, 10:14 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I'm sorry, but this is quite a difficult transformation. There are several of us here who are prepared to give quick answers to specific technical questions, but I don't think there is anyone here who is prepared to offer free XSLT programming services. It would take some careful study before I were even able to suggest a general design approach.

If you have a budget to pay for XSLT consultancy help, it would be a different matter.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transforming XML to XML using XSL sakreck XSLT 0 January 9th, 2007 11:48 AM
transforming a XML on the basis of another XML Diex75 XSLT 4 November 9th, 2006 09:11 AM
Transforming data in required XML Format pvasudevan XSLT 6 September 6th, 2006 02:34 AM
problem transforming XML using xslt micky3248 XSLT 7 August 18th, 2006 03:52 AM
Please help, xml transforming using xslt !!! daula7 XSLT 0 May 11th, 2006 01:29 PM



All times are GMT -4. The time now is 05:09 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.