XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
N K N KSubject: not able to set namespace defenition
Author: N K N K
Date: 03 Nov 2009 12:41 AM
Style sheet template as follows ,

When I print the content of err_doc variable , I get the documetn without namespace declaration(though namespace prefix(com) is added without declarion) , as follows


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"


xmlns:com="com.ekaplus.commons.document"


xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory"

xmlns:rfc="urn:sap-com:document:sap:rfc:functions"
xmlns:not="http://www.ekaplus.com/NotifyEvent/"


xmlns:java="http://saxon.sf.net/java-type"
xmlns:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon"

exclude-result-prefixes="java,com" version="1.0">




<xsl:template name="main" match="/">

<xsl:variable name="err_doc">

<xsl:element name="GenericDocument"
namespace="com.ekaplus.commons.document">
<xsl:attribute name="document_Id">
<xsl:value-of select="'ERROR_DOC'"/>
</xsl:attribute>

<xsl:attribute name="description">
<xsl:value-of select="'Error document after
validation'"/>
</xsl:attribute>


<xsl:attribute name="name">
<xsl:value-of select="'Error response document'"/>
</xsl:attribute>
<xsl:attribute name="created_date">
<xsl:value-of select="'2009-10-26'"/>
</xsl:attribute>


<xsl:element name="PropertyData"
namespace="com.ekaplus.commons.document">
<xsl:element name="PropertyData"
namespace="com.ekaplus.commons.document">
<xsl:attribute name="pkey">
<xsl:value-of select="'Status'"/>
</xsl:attribute>
<xsl:attribute name="pvalue">
<xsl:value-of select="'FAILED'"/>
</xsl:attribute>



<xsl:call-template name="applyTemplateForError"/>

</xsl:element>
</xsl:element>
</xsl:element>

</xsl:variable>

<xsl:copy-of select="$err_doc"/>




</xsl:template>

<xsl:template name="applyTemplateForError">



<xsl:variable name="ret">

<xsl:if test="rfc:Z_BAPI_BANK_CUSTOMER_VENDOR/INPUT_BUPA/NAME_1
= ''">

<xsl:element name="PropertyData"
namespace="com.ekaplus.commons.document">
<xsl:attribute name="pkey">
<xsl:value-of select="'Message'"/>
</xsl:attribute>
<xsl:attribute name="pvalue">
<xsl:value-of select="'ERR_CP_001'"/>
</xsl:attribute>
<xsl:element name="PropertyData"
namespace="com.ekaplus.commons.document">
<xsl:attribute name="pkey">
<xsl:value-of select="'MessageDescr'"/>
</xsl:attribute>
<xsl:attribute name="pvalue">
<xsl:value-of select="'NAME_1 is missing in
source document'"/>
</xsl:attribute>
</xsl:element>
</xsl:element>


</xsl:if>


</xsl:variable>
<xsl:copy-of select="$ret"/>

</xsl:template>
</xsl:stylesheet>

result as follows

<com:GenericDocument document_Id="ERROR_DOC" description="Error document
after validation" name="Error response document"
created_date="2009-10-26"><com:PropertyData><com:PropertyData pkey="Status"
pvalue="FAILED"><com:PropertyData pkey="Message"
pvalue="ERR_CP_001"><com:PropertyData pkey="MessageDescr" pvalue="NAME_1 is
missing in source
document"/></com:PropertyData></com:PropertyData></com:PropertyData></com:GenericDocument>

I use style studio 2007 XML proferssional version release 2
Any input on this?

Regards
Brijesh N K

Posttop
(Deleted User) Subject: not able to set namespace defenition
Author: (Deleted User)
Date: 03 Nov 2009 09:50 AM
Hi Brijesh,
how are you displaying the result? For instance, if you are using Firefox, the stylesheet it uses for displaying XML data will strip any namespace declaration.
From what I see, running your stylesheet with Saxon under Stylus Studio 2007 will generate the proper namespace definition.

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.