Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 7th, 2006, 04:40 AM
Registered User
 
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to venjamin
Default how can i make it using xslt

hi,

i am new to xslt programing, please guide me..
i want output.xml as result from input.xml in using xslt.
is it possible in xslt?
i will highly appreciate if you help me.

input.xml
-------------------------------------------
?xml version="1.0" encoding="UTF-8"?>
<ns0:mapping01s_mt xmlns:ns0="http://www.test.net/test01">
    <maproot>
        <h01>zh01</h01>
        <h02>zh02</h02>
        <b01>
            <b0101>zb0101</b0101>
            <b0102>zb0102</b0102>
        </b01>
        <b01>
            <b0101>zb0201</b0101>
            <b0102>zb0202</b0102>
        </b01>
    </maproot>
</ns0:mapping01s_mt>


output.xml
------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<ns0:mapping01t_mt xmlns:ns0="http://www.test.net/test01">
    <mapping>
        <h01>zh01</h01>
        <h02>zh02</h02>
        <b0101>zb0101</b0101>
        <b0102>zb0102</b0102>
    </mapping>
    <mapping>
        <h01>zh01</h01>
        <h02>zh02</h02>
        <b0101>zb0201</b0101>
        <b0102>zb0202</b0102>
    </mapping>
</ns0:mapping01t_mt>


 
Old October 9th, 2006, 04:34 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Something like this:

<xsl:template match="ns0:mapping01s_mt" xmlns:ns0=...>
  <xsl:copy>
    <xsl:apply-templates select="maproot/b01"/>
  </
</

<xsl:template match="b01">
  <mapping>
    <xsl:copy-of select=" ../h01 | ../h02 | * "/>
  </
</


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





Similar Threads
Thread Thread Starter Forum Replies Last Post
General XSLT Questions in the XSLT Forum jminatel BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 0 March 31st, 2008 07:50 PM
Can XSLT read DTD/schema and Generate XSLT.. ROCXY XSLT 1 November 6th, 2006 09:39 AM
dynamic xslt -> xslt creation namespace problem jkmyoung XSLT 2 July 15th, 2006 12:42 AM
XSLT to make multiple hyperlinked HTML files dai.hop XSLT 1 January 11th, 2006 03:05 PM
merge two xml file and make new xml using xslt ketan XSLT 0 September 21st, 2004 08:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.