Problems. Transformation and namespaces.

Discussion in 'XML' started by Pablo, Jan 28, 2005.

  1. Pablo

    Pablo Guest

    Hello,

    I wrote an xslt to apply to a XML. The output that I expect is:

    <TEST>
    Test Output
    </TEST>

    But i get en empty XML...I know that is a problem of the namespace in
    XML but I don't know how solve it...so please...someone could explain
    me what is wrong?

    Thank you in advance.


    ---
    XML FILE
    ---
    <deployment xmlns="http://xml.apache.org/axis/wsdd/"
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

    <service name="TestAxis" provider="java:RPC" style="rpc"
    use="encoded">
    <parameter name="wsdlTargetNamespace" value="http://www.xyz.com"/>
    </service>

    </deployment>
    ---

    ---
    XSLT FILE
    ---
    <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
    <xsl:eek:utput method = "xml" indent = "yes"/>

    <xsl:template match = "deployment">
    <TEST>
    <xsl:apply-templates select="service"/>
    </TEST>
    </xsl:template>

    <xsl:template match = "deployment">
    Test Output
    </xsl:template>

    </xsl:stylesheet>

    ---
    Pablo, Jan 28, 2005
    #1
    1. Advertising

  2. Pablo

    Joris Gillis Guest

    Tempore 10:30:36, die Friday 28 January 2005 AD, hinc in foro {comp.text.xml} scripsit Pablo <>:

    > I get en empty XML...I know that is a problem of the namespace in
    > XML but I don't know how solve it...so please...someone could explain
    > me what is wrong?

    Hi,

    You have to include the namespace uri when you try matching 'deployment' elements. You can do this by declaring a namespace with a uri identical to the corresponding uri in the XML document. You are free to choose a prefix name. (in this example: 'wsd')

    <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" xmlns:wsd="http://xml.apache.org/axis/wsdd/" version="1.0">
    <xsl:eek:utput method = "xml" indent = "yes"/>

    <xsl:template match="wsd:deployment">
    Test Output
    </xsl:template>

    </xsl:stylesheet>


    regards,
    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
    Deserta faciunt et innovationem appelant
    Joris Gillis, Jan 28, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bilal
    Replies:
    7
    Views:
    700
    Bilal
    Sep 27, 2006
  2. George Economos
    Replies:
    4
    Views:
    339
    Victor Bazarov
    Aug 23, 2005
  3. bizt
    Replies:
    2
    Views:
    533
    Joseph J. Kesselman
    Jul 11, 2008
  4. Îίκος

    Encoding transformation problems

    Îίκος, May 27, 2006, in forum: Perl Misc
    Replies:
    5
    Views:
    87
    Nicky
    May 27, 2006
  5. N. Demos
    Replies:
    0
    Views:
    85
    N. Demos
    May 13, 2005
Loading...

Share This Page