on 10-11-2006 11:08 AM
Hi Prashant,
I am applying xslt mapping in my scenario.
The required format is:
<BatchReceiptPw <b>xmlns="http://AltInn.no/webservices/"</b> >
<enterpriseSystemId>int</enterpriseSystemId>
<batchId>string</batchId>
<password>string</password>
<version>int</version>
</BatchReceiptPw>
The output I am getting is:
<?xml version="1.0" encoding="UTF-8" ?>
<ns1:BatchReceiptPw <b>xmlns:ns1="http://AltInn.no/webservices/"</b> >
<ns1:enterpriseSystemId>826</ns1:enterpriseSystemId>
<ns1:batchId>8e8d6e34-60b3-4c42-89f8-dce662913d2f</ns1:batchId>
<ns1:password>altinn1</ns1:password>
<ns1:version>1.0</ns1:version>
</ns1:BatchReceiptPw>
The i apply your XSLT code to remove the name sapce.
The code you gave me is : <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<xsl:template match="/|comment()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
The output i am getting after applying your code is
:
<?xml version="1.0" encoding="utf-8" ?>
<BatchReceiptPw>
<enterpriseSystemId>826</enterpriseSystemId>
<batchId>8e8d6e34-60b3-4c42-89f8-dce662913d2f</batchId>
<password>altinn1</password>
<version>1.0</version>
</BatchReceiptPw>
How do i retain the highlighted part (xmlns="http://AltInn.no/webservices/")in the final output as in the required structure.
Pls advice
Regards,
Raj
Hi Ashish,
Can you please post us how are you getting the output
The output I am getting is:
<?xml version="1.0" encoding="UTF-8" ?>
<ns1:BatchReceiptPw xmlns:ns1="http://AltInn.no/webservices/" >
<ns1:enterpriseSystemId>826</ns1:enterpriseSystemId>
<ns1:batchId>8e8d6e34-60b3-4c42-89f8-dce662913d2f</ns1:batchId>
<ns1:password>altinn1</ns1:password>
<ns1:version>1.0</ns1:version>
</ns1:BatchReceiptPw>
is it by using a XSLT mapping. If so then lets try to modify that XSLT mapping achieve the required output.
The XSLT mapping which you used to remove namespace will remove all the namespaces. You can also use the following XSLT mapping instead of the the remove namespace XSLT.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<xsl:template match="/">
<BatchReceiptPw xmlns:ns1="http://AltInn.no/webservices/" >
<enterpriseSystemId><xsl:value-of select="ns1:BatchReceiptPw/enterpriseSystemId"/>
</enterpriseSystemId>
<batchId><xsl:value-of select="ns1:BatchReceiptPw/batchId"/>
</batchId>
<password><xsl:value-of select="ns1:BatchReceiptPw/password"/>
</password>
<version><xsl:value-of select="ns1:BatchReceiptPw/version"/>
</version>
</BatchReceiptPw>
</xsl:template>
</xsl:stylesheet>
But the advisable way si to change thefirst mapping instead of doing this workaround.
Thanks,
Prakash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am doing normal message mapping. And there is no XSLT mapping involved to achieve this result.
<?xml version="1.0" encoding="UTF-8" ?>
<ns1:BatchReceiptPw xmlns:ns1="http://AltInn.no/webservices/" >
<ns1:enterpriseSystemId>826</ns1:enterpriseSystemId>
<ns1:batchId>8e8d6e34-60b3-4c42-89f8-dce662913d2f</ns1:batchId>
<ns1:password>altinn1</ns1:password>
<ns1:version>1.0</ns1:version>
</ns1:BatchReceiptPw>.
Now if i apply the code you gave me earlier, it removes all the name spaces.
Please Advice.
Regards,
Ashish
Hi,
Then apply this code
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<xsl:template match="/">
<BatchReceiptPw xmlns:ns1="http://AltInn.no/webservices/" >
<enterpriseSystemId><xsl:value-of select="ns1:BatchReceiptPw/enterpriseSystemId"/>
</enterpriseSystemId>
<batchId><xsl:value-of select="ns1:BatchReceiptPw/batchId"/>
</batchId>
<password><xsl:value-of select="ns1:BatchReceiptPw/password"/>
</password>
<version><xsl:value-of select="ns1:BatchReceiptPw/version"/>
</version>
</BatchReceiptPw>
</xsl:template>
</xsl:stylesheet>
Thanks,
Pakash
Hi,
You need to prefix ns1: to all the fields
use this XSLT
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns1="http://AltInn.no/webservices/" >
<xsl:output method="xml" indent="no"/>
<xsl:template match="/">
<BatchReceiptPw xmlns="http://AltInn.no/webservices/" >
<enterpriseSystemId><xsl:value-of select="ns1:BatchReceiptPw/ns1:enterpriseSystemId"/>
</enterpriseSystemId>
<batchId><xsl:value-of select="ns1:BatchReceiptPw/ns1:batchId"/>
</batchId>
<password><xsl:value-of select="ns1:BatchReceiptPw/ns1:password"/>
</password>
<version><xsl:value-of select="ns1:BatchReceiptPw/ns1:version"/>
</version>
</BatchReceiptPw>
</xsl:template>
</xsl:stylesheet>
Thanks,
Prakash
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.