XSL transformation not finding template

Kevin Dean

Usenet Archive
Joined
Sep 9, 2003
Messages
3
Reaction score
0
I'm trying to create an XSL transformation that will strip out development-specific attributes from deployment descriptors and other XML files. I have already successfully done so with web.xml but I'm at a complete loss as to what is wrong with the one below. This is a very abbreviated server-config.wsdd:

<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <globalConfiguration> <parameter name="adminPassword" value="admin"/> <parameter name="sendXsiTypes" value="true"/> <parameter name="sendMultiRefs" value="true"/> <parameter name="sendXMLDeclaration" value="true"/> <parameter name="axis.sendMinimizedElements" value="true"/> <requestFlow> <handler type="java:eek:rg.apache.axis.handlers.JWSHandler"> <parameter name="scope" value="session"/> </handler> <handler type="java:eek:rg.apache.axis.handlers.JWSHandler"> <parameter name="scope" value="request"/> <parameter name="extension" value=".jwr"/> </handler> <handler type="java:eek:rg.apache.axis.handlers.SOAPMonitorHandler"/> </requestFlow> <responseFlow> <handler type="java:eek:rg.apache.axis.handlers.SOAPMonitorHandler"/> </responseFlow> </globalConfiguration> </deployment>

What I'd like to do is copy the entire file but filter out the global request and response flow elements. To that end, I have created the following XSL:

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:eek:utput method="xml" version="1.0" />

<xsl:template match="@*|node">
<xsl:copy>
<xsl:apply-templates select="@*|node" />
</xsl:copy>
</xsl:template>

<xsl:template match="/deployment/globalConfiguration/requestFlow" />

<xsl:template match="/deployment/globalConfiguration/responseFlow" /> </xsl:stylesheet>

Basically, I want the XSL transformation to remove the
/deployment/globalConfiguration/requestFlow and
/deployment/globalConfiguration/responseFlow paths. As I said earlier, I have done this quite successfully in web.xml (stripping out Axis administration servlet) but I'm stumped as to why this wouldn't be working in this instance.

Any help would be most appreciated.
 

vin sharma

Usenet Archive
Joined
Sep 5, 2003
Messages
3
Reaction score
0
Kevin said:
I'm trying to create an XSL transformation that will strip out development-specific attributes from deployment descriptors and other XML files. I have already successfully done so with web.xml but I'm at a complete loss as to what is wrong with the one below. This is a very abbreviated server-config.wsdd:

<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> ....

</deployment>

What I'd like to do is copy the entire file but filter out the global request and response flow elements. To that end, I have created the following XSL:

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:eek:utput method="xml" version="1.0" /> ....

</xsl:stylesheet>

Basically, I want the XSL transformation to remove the
/deployment/globalConfiguration/requestFlow and
/deployment/globalConfiguration/responseFlow paths. As I said earlier, I have done this quite successfully in web.xml (stripping out Axis administration servlet) but I'm stumped as to why this wouldn't be working in this instance.

Any help would be most appreciated.

Try specifying the source namespace in the stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://xml.apache.org/axis/wsdd/" version="1.0">

-vin
 

Kevin Dean

Usenet Archive
Joined
Sep 9, 2003
Messages
3
Reaction score
0
No good. I still get the identity transformation back. Here's an even simpler version of the XSL that should return an empty transformation but doesn't:

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

<xsl:template match="@*|node">
<xsl:copy>
<xsl:apply-templates select="@*|node" />
</xsl:copy>
</xsl:template>

<xsl:template match="/deployment" />
</xsl:stylesheet>
 

Marrow

Usenet Archive
Joined
Apr 9, 2001
Messages
408
Reaction score
0
Hi Kevin,

Because the elements you are trying to filter out are bound to the default namespace (i.e. xmlns="http://xml.apache.org/axis/wsdd/" ) in your input XML.

So to match those elements - you need to declare that namespace in your stylesheet with an arbitrary prefix (remember that namespaces are matched by their URI rather than prefix). Then use that arbitrary prefix in your match patterns, e.g.

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

<xsl:template match="@*|node">
<xsl:copy>
<xsl:apply-templates select="@*|node" />
</xsl:copy>
</xsl:template>

<xsl:template match="ws:requestFlow | ws:responseFlow" />

</xsl:stylesheet>

Hope this helps
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger) http://www.topxml.com/Xselerator
 

Kevin Dean

Usenet Archive
Joined
Sep 9, 2003
Messages
3
Reaction score
0
Perfect, thank you.

Marrow said:
Hi Kevin,

Because the elements you are trying to filter out are bound to the default namespace (i.e. xmlns="http://xml.apache.org/axis/wsdd/" ) in your input XML.

So to match those elements - you need to declare that namespace in your stylesheet with an arbitrary prefix (remember that namespaces are matched by their URI rather than prefix). Then use that arbitrary prefix in your match patterns, e.g.

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

<xsl:template match="@*|node">
<xsl:copy>
<xsl:apply-templates select="@*|node" />
</xsl:copy>
</xsl:template>

<xsl:template match="ws:requestFlow | ws:responseFlow" />

</xsl:stylesheet>

Hope this helps
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger) http://www.topxml.com/Xselerator
 

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

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top