Subject: Why doesn't this simple XSLT (Identity transform) work?
From: <ohaya@xxxxxxx>
Date: Tue, 1 Dec 2009 19:43:21 -0500
|
Hi,
It's been awhile since I've worked with XSLT, but I'm having to implement one that removes an element (<Signature>) from the incoming (SOAP) message. I know that this should be simple, and I know that I have written similar XSLT before, but for some reason, I can get this to work.
Here's an example SOAP message:
<SOAP:Envelope xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header>
<wsse:Security SOAP:mustUnderstand="1">
<saml:Assertion MajorVersion="1" MinorVersion="1" AssertionID="ID46a342be-9d3a-437a-8a26-85fcd72a723d" Issuer="http://foo.com" IssueInstant="2009-12-01T21:55:13Z">
<saml:Conditions NotBefore="2009-12-01T21:54:58Z" NotOnOrAfter="2009-12-01T22:10:28Z"/>
<saml:AuthenticationStatement AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:unspecified" AuthenticationInstant="2009-12-01T21:55:13Z">
.....
</saml:AuthenticationStatement>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
...
</Signature></saml:Assertion></wsse:Security>
</SOAP:Header>
<env:Body>
<m:hello xmlns:m="http://services">
<m:x>123</m:x></m:hello>
</env:Body>
</SOAP:Envelope>
It's a SOAP message with a SAML assertion...
And, here's the XSLT that I'm using:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/extensions"
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
>
<xsl:output method="xml"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//Signature">
</xsl:template>
</xsl:stylesheet>
What the XSLT seems to be doing is just doing the Identity transform, and copying everything from the input message to the output, i.e., the "<xsl:template match="//Signature">" is not getting processed at all.
I've tried different things for that template match, including just "Signature", a "fully-qualified" match term, etc.
I have the impression that the XSLT processing should always use the more specific match (i.e., the one above, and not the Identity transform), but it doesn't seem to be working :(...
I've tried running this under an XSLT debugger (in oXygen), and I can see that it never gets to that template match.
I'm sure that I am missing something really obvious here, but I've been staring at this for awhile, and can't see it, so I hope that someone can help :(!!
Thanks in advance!!
Jim
|