How to retain the namespace xmlns:enc in XML thro XSLT ?
Question posted by: Rajesh
(Guest)
on
July 18th, 2006 06:55 PM
I am trying to pass the namespace, which is in my Original Message, to
a Java method for further processing. In the original message the
xmlns:xenc namespace is present. I make a call to Java function and
pass the whole XML message along with tags and values. In my Java
function when I tried to print the XML message which is receieved by
the XSLT proc. it has omitted the xmlns:xenc namespace which is
creating a problem in Java function for further processing. How can I
instruct the XSLT processor not to omit any of the namespaces which is
in the Original Namespaces so that Java fucntion will receive the fully
qualified XML message?
Original Message which is passing to the XSLT Processor with xmlns:xenc
namespace:::
<XIPMessage version="1.0">
<XIPBody>
<OrderHeader>
<EMasterNumber>11111</EMasterNumber>
<xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#
" Type="http://www.w3.org/2001/04/xmlenc#Element">
<xenc:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
<ds:KeyInfo>
<xenc:EncryptedKey>
<xenc:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
<xenc:CipherData>
<xenc:CipherValue>KA1ia0wKl3KfCS</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedKey>
</ds:KeyInfo>
<xenc:CipherData>
<xenc:CipherValue>aKN68CYqMqXa+</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedData>
<PONumber>101012</PONumber>
</OrderHeader>
</XIPBody>
</XIPMessage>
Message going from XSLT processor to Java fuction:(Omitting the
xmlns:xenc namespace):::
<XIPMessage version="1.0">
<XIPBody>
<OrderHeader>
<EMasterNumber>11111</EMasterNumber>
<xenc:EncryptedData
Type="http://www.w3.org/2001/04/xmlenc#Element">
<xenc:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
<ds:KeyInfo>
<xenc:EncryptedKey>
<xenc:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
<xenc:CipherData>
<xenc:CipherValue>KA1ia0wKl3KfCS</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedKey>
</ds:KeyInfo>
<xenc:CipherData>
<xenc:CipherValue>aKN68CYqMqXa+</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedData>
<PONumber>101012</PONumber>
</OrderHeader>
</XIPBody>
</XIPMessage>
XSL:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:java="http://xml.apache.org/xslt/java"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
xmlns:decrypter="com.xerox.xip.x509.Decrypter">
<xsl:template match="/">
<xsl:apply-templates select="decrypter:decryptXMLNode(.)"/- Calling
Java Mehod which does decryption of message
</xsl:template>
.......
.......
....further validations only on elements of XML...
</xsl:stylesheet>
1
Answer Posted
Rajesh wrote:
Quote:
Originally Posted by
Original Message which is passing to the XSLT Processor with xmlns:xenc
namespace:::
<XIPMessage version="1.0">
<XIPBody>
<OrderHeader>
<EMasterNumber>11111</EMasterNumber>
<xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#
" Type="http://www.w3.org/2001/04/xmlenc#Element">
Quote:
Originally Posted by
Message going from XSLT processor to Java fuction:(Omitting the
xmlns:xenc namespace):::
<XIPMessage version="1.0">
<XIPBody>
<OrderHeader>
<EMasterNumber>11111</EMasterNumber>
<xenc:EncryptedData
Type="http://www.w3.org/2001/04/xmlenc#Element">
Quote:
Originally Posted by
<xsl:template match="/">
<xsl:apply-templates select="decrypter:decryptXMLNode(.)"/- Calling
The processor passes a node set to that decryptXMLNode function and not
any serialized markup. If that function does not properly serialize the
nodes then I don't think that is an XSLT problem. You will have to ask
the author of decryptXMLNode or at least anyone familiar with the
working of that function if it does not produce the result you want.
--
Martin Honnen
http://JavaScript.FAQTs.com/
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 197,029 network members.
Top Community Contributors
|