You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by m2 r2sj <m2...@gmail.com> on 2006/05/02 01:08:14 UTC

Re: Namespace issue

Thanks for the reply.I have attached the XSLT below for your reference.

I did quite R&D on the XSLT signature for both DOM and JDOM and am still
facing issue with namespaces.I need an expert help in resolving the
namespace issue.

Here are the steps for DOM XSLT signature :
1)Set the namespace aware to true  as follows.
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 dbf.setNamespaceAware(true);
2)Parsed the DOM and signed  an XSLT - Works fine
 <xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
            <xsl:template match="/">
              <xsl:copy-of select="Flow"/>
            </xsl:template>
</xsl:stylesheet>
3)Then validated   - Works fine.
If i don't set the namespace aware to true, the signing & validation fail.

Here are steps for JDOM XSLT signature
1)Converted DOM to JDOM using DOMOutputter
2)Singed DOM converted from JDOM- I get the following error
I dont see the way to set the namespace aware to true for the
DOMOutputter so that DOM converted from JDOM aware that namesspace

Can any expert point me what i am doing wrong / best way to set the
namespace aware for the DOM conveted from JDOM to resolve this issue.


<?xml version="1.0" encoding="UTF-8" ?>
<Flow Id="new" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Empid>121212</Empid>
<Salary>120000</Salary>
<Command>
  <xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
            <xsl:template match="/">
              <xsl:copy-of select="Flow/Salary"/>
            </xsl:template>
 </xsl:stylesheet>
</Command>
<Skills>
  <xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
            <xsl:template match="/">
              <xsl:copy-of select="Flow"/>
            </xsl:template>
</xsl:stylesheet>
</Skills>
</Flow>

 Thanks in advance.I would really appreciate any expert help!




On 4/28/06, Milan Tomic <to...@yahoo.com> wrote:
>
>
> We are not able to help you, unless you show us small peace of your code
> and XML (XSLT). I suppose
> that mentioned exception throws XML parser (Xerces)? In that case you
> might ask this question in
> Xerces mailing list. Btw, have you used setNamespaceAware(true) method?
>
> Best regards,
> Milan
>
>
> --- m2 r2sj <m2...@gmail.com> wrote:
>
> > I am doing an XSLT signature and validation.When i do an XSLT sign , i
> am
> > not getting any error, it is working fine.But when i try to validate an
> > XSLT , i am getting the following error.
> > Help would be appreciated.Can any expert provide a resolution to this
> issue.
> >
> > SystemId Unknown; Line #8; Column #141; Attribute "xsl" bound to
> namespace "
> > http://www.w3.org/2000/xmlns/" was already specified for element
> > "xsl:stylesheet".
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

Re: Namespace issue

Posted by Milan Tomic <to...@yahoo.com>.
It seems that DOMOutputter have/had lots of bugs dealing with namespaces. For example, take a look
into this:

http://www.jdom.org/pipermail/jdom-interest/2004-April/013775.html

You might consider using XMLOutputter, instead.

In short, your problem is that namespace "http://www.w3.org/2000/xmlns/" was declared twice in
your XML. I cannot see that from the XML you have posted. Visit http://www.w3.org/2000/xmlns/ link
for details about meaning for that namespace. Do you see the same error if <xsl:stylesheet>
element occur only once in your XML document (only in <Command>, not in <Skills>)?

You might consider asking this question in JDOM mailing list.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Namespace issue

Posted by Milan Tomic <to...@yahoo.com>.
P.S. I have just noticed that your XML document doesn't have declaration for default namespace.
Try changing this:

<Flow Id="new" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

into:

<Flow Id="new" xmlns="http://www.example.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

It might help.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com