How to retain the namespace xmlns:enc in XML thro XSLT ?

R

Rajesh

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>
 
M

Martin Honnen

Rajesh wrote:

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">
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">
<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.
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top