469,323 Members | 1,516 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

Default Namespace Error.No element displayed.

I have an Input XML document which has a default namspace.
This document is generated by a 3rd party system.

Expand|Select|Wrap|Line Numbers
  1. <FIXML xmlns="http://www.fixprotocol.org/FIXML-4-4">
  2.     <Order Acct="1" ExDest="ExchDest">
  3.         <Hdr Snt="2007-04-05T13:34:47"/>
  4.         <Instrmt Issr="Barclays" MMY="200903"/>
  5.     </Order>
  6. </FIXML>
Now,if I use this namespace in my XSL style sheet,
no element gets displayed.

Expand|Select|Wrap|Line Numbers
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
  3. xmlns="http://www.fixprotocol.org/FIXML-4-4" >
  4. <xsl:output method="xml"/>
  6. <xsl:template match="FIXML">
  7. <xsl:apply-templates  select ="Order"/>
  8. </xsl:template>
  10. <xsl:template match="Order">
  11. <NewSingleOrder>
  13. <ID>
  14. <xsl:value-of select="@Acct"/> 
  15. </ID>
  16. </NewSingleOrder>
As the input XML is generated dynamically and given to me,I cannot
delete this from the Input XML.

How can I solve this ?

I am unable to delete the default namspace from the input XML document
Apr 17 '07 #1
3 1195
839 Expert 512MB
Could you make a copy of that XML that will contain same data without the namespace attribute?
If manually not, then by code.
If load the XML in a DOM object, you might alter directly the DOM object before passing to XSL (then no copy would be necessary).
Apr 17 '07 #2
The XML input document is dynamically being given the associated XSL
by using transform

Expand|Select|Wrap|Line Numbers
  1. ByteArrayOutputStream out = new ByteArrayOutputStream();
  2. transformer.transform(new DOMSource(singleOrder),new StreamResult(out));
  4. where singleOrder is the Input Document and 'out' acts as a holder of
  5. the transformation.
Apr 17 '07 #3
I have solved this issue.
Apr 17 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by John L. Clark | last post: by
3 posts views Thread by Mike Dickens | last post: by
5 posts views Thread by David Thielen | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.