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 12th, 2008, 09:34 PM
Registered User
 
Join Date: Nov 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default xml transformation

I have a xml file named example_source to transform to another xml file named example_result,who can give the xslt file?Because the two files are too long,I will email the two files to helpers.Thanks.
 
Old October 12th, 2008, 09:35 PM
Registered User
 
Join Date: Nov 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

who can give the xslt file?waiting...
 
Old October 12th, 2008, 09:38 PM
Registered User
 
Join Date: Nov 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

anyone?
 
Old October 12th, 2008, 11:33 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Default

This is not the way of asking doubts or help. Show the xml input and output sample. Anyone in this forum could help you on the outline.

Rummy
 
Old October 13th, 2008, 03:28 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This isn't a free programming service. We can help you if you have specific problems, but writing the code is your responsibility. If there's an aspect of the transformation that you don't know how to tackle, then cut it down to a small sample that illustrates the essence of the problem, and explain why you are finding it difficult.

Oh, and posting a message at 3.34am on a Sunday night and then expressing impatience that no-one has answered by 3.38am isn't going to win you friends.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old October 14th, 2008, 02:23 AM
Registered User
 
Join Date: Nov 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm sorry that I ignore I'm in china and our time is different.
This is my problem.

 
Old October 14th, 2008, 02:27 AM
Registered User
 
Join Date: Nov 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

here is the input file:
<?xml version='1.0' encoding='UTF-8'?>


<xmi:XMI xmi:version='2.1' timestamp='Thu Oct 09 10:46:16 CST 2008' xmlns:uml='http://schema.omg.org/spec/UML/2.0' xmlns:xmi='http://schema.omg.org/spec/XMI/2.1'>
    <xmi:Documentation xmi:Exporter='MagicDraw UML' xmi:ExporterVersion='11.0'/>
    <uml:Model xmi:id='eee_1045467100313_135436_1' name='Data' visibility='public'>
        <ownedMember xmi:type='uml:Model' xmi:id='_11_0_279013c_1218794826781_211567_121' name='Red' visibility='public' nestingPackage='eee_1045467100313_135436_1' owningPackage='eee_1045467100313_135436_1' supplierDependency='_11_0_279013c_1218794888718_86 5431_134'>
        <xmi:Extension xmi:Extender='MagicDraw UML 11.0' xmi:ExtenderID='MagicDraw UML 11.0'>
                <modelExtension>
                    <appliedStereotypeInstance xmi:type='uml:InstanceSpecification' xmi:id='_11_0_279013c_1218794869640_911639_131' visibility='public' stereotypedElement='_11_0_279013c_1218794826781_21 1567_121'>
                        <classifier xmi:type='uml:Stereotype' href='smp2_profile.xml|_11_0_279013c_1218684052656 _550962_58'>
                            <xmi:Extension xmi:Extender='MagicDraw UML 11.0' xmi:ExtenderID='MagicDraw UML 11.0'>
                                <referenceExtension referentPath='UML_Profile::Namespace' referentType='Stereotype'/>
                            </xmi:Extension>
                        </classifier>
                    </appliedStereotypeInstance>
                </modelExtension>
        </xmi:Extension>
            <ownedMember xmi:type='uml:Class' xmi:id='_11_0_279013c_1218795065062_330374_171' name='model1' visibility='public' clientDependency='_11_0_279013c_1218795898093_3755 59_305' owningPackage='_11_0_279013c_1218794826781_211567_ 121'>
            </ownedMember>
        </ownedMember>
    </uml:Model>
</xmi:XMI>

 
Old October 14th, 2008, 02:32 AM
Registered User
 
Join Date: Nov 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

and I want to transform it to the following file:

<?xml version="1.0" encoding="UTF-8"?>

<Namespace Id="Red" Name="Red">
  <Type xsi:type="catalogue:Model" Id="Red.Model1" Name="Model1">
  </Type>
</Namespace>

but I find I can only get the name of namespace "Red".
Who can give the code to transformation(.xsl),thanks.

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

You don't want to produce this output:

<?xml version="1.0" encoding="UTF-8"?>

<Namespace Id="Red" Name="Red">
  <Type xsi:type="catalogue:Model" Id="Red.Model1" Name="Model1">
  </Type>
</Namespace>

because it isn't namespace-well-formed. It uses two namespace prefixes "xsi" and "catalogue" that have not been declared. What is the namespace URI corresponding to prefix "catalogue"? So I'm not sure whether your problem is that you are trying to produce invalid output, or that you don't know how to generate the required namespace declarations. It would help to see your code, and the output that it is producing, compared with the desired output.

(I may be confused partly because you have an element in the output called "Namespace", which isn't an XML namespace.)

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old October 14th, 2008, 07:50 PM
Registered User
 
Join Date: Nov 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<?xml version="1.0" encoding="UTF-8"?>

<Namespace Id="Red" Name="Red">
  <Type xsi:type="catalogue:Model" Id="Red.Model1" Name="Model1">
  </Type>
</Namespace>

what I mean is that the words with red color are from the information of input file,and the other parts of the output file is written by the creator.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Is XML supports transformation of HTML to XML? zeeonline XSLT 1 July 28th, 2006 05:13 PM
Problem in XML to XML transformation jkuravatti XSLT 2 May 5th, 2006 11:21 AM
XML transformation problem... muki XSLT 0 January 31st, 2006 10:36 PM
Xml to Xml Transformation using xslt ShaileshShinde XSLT 1 July 20th, 2005 01:20 AM
XML to XML transformation using XSLT karjagis XSLT 3 July 30th, 2004 06:13 AM





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