RE: [xsl] Trying to understand XSLT processing

Subject: RE: [xsl] Trying to understand XSLT processing
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 15 Dec 2009 10:09:04 -0000
I can't think of any reason for this behaviour, other than the possibility
that your XSLT processor is stripping out elements from the body of
xsl:message. This would be consistent with the way xsl:attribute handles
element content in XSLT 1.0, so it's not impossible - processors can do
pretty well anything they like with xsl:message output. Try using the same
construct outside the context of xsl:message.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

> 
> I have an XML file:
> 
> <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-20040
> 1-wss-wssecurity-secext-1.0.xsd" 
> xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";>
>     <SOAP:Header>
>         <wsse:Security SOAP:mustUnderstand="1">
>         </wsse:Security></SOAP:Header>
>     <SOAP:Body>
>         <m:hello xmlns:m="http://services";>
>             <m:x>123</m:x>
>         </m:hello>
>     </SOAP:Body>
> </SOAP:Envelope>
> 
> and I just want to output the <SOAP:Body> to a message, so I 
> have an XSLT that looks like this:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";        
>     xmlns:SOAP="http://www.w3.org/2003/05/soap-envelope";
>     xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
>     <xsl:output method="xml" /> 
>     
>     <xsl:template match="/">
>         <xsl:message>*****you just hit the XSLT ******</xsl:message>
>         <xsl:message>*****BODY CONTENTS****[<xsl:copy-of 
> select="."/>]</xsl:message>
>     </xsl:template>
>     
> </xsl:stylesheet>
> 
> However, when I execute that XSLT, I'm getting an empty 
> nodeset for the output:
> 
> *****you just hit the XSLT ******
> *****BODY CONTENTS****[]
> 
> So, I was wondering if someone can explain what I am doing 
> wrong with that XSLT above?  Why doesn't the <xsl:copy-of> 
> give me the <Body>?
> 
> Thanks, and sorry if this is probably a really dumb question :(...
> 
> Jim

Current Thread