Problems. Transformation and namespaces.

P

Pablo

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>

---
 
J

Joris Gillis

Tempore 10:30:36 said:
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,
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top