Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > problem with namespace and simple query

Reply
Thread Tools

problem with namespace and simple query

 
 
Howard
Guest
Posts: n/a
 
      02-04-2005
Hi,

I am using a very simple xslt file to get info from an xml document.
The problem seems to me to be that the xml doc uses a namespace, and I don't
know how to set up my xslt to recognize it correctly. If I remove the
namespace specification from the xml, I can query the node I want perfectly.
But with that namespace in there, it fails. Can someone help?

Here's a simpilified version of the xml document, with that namespace stuff:

<?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
some stuff I don't care about
</SIgnedInfo>
<SignatureValue>
the stuff I want
</SignatureValue>
</Signature>

and here's my xslt file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:element name="test1">
<xsl:value-of select="/Signature/SignatureValue"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

If I remove that xmlns part of the xml (which isn't really an option when
trying to use the real file), it works fine. But as it is above, it gives
me nothing. I'm pretty sure I have to specify the namespace somehow in the
xslt, but how, and where?

Thanks much,
Howard




 
Reply With Quote
 
 
 
 
Howard
Guest
Posts: n/a
 
      02-04-2005

"Howard" <(E-Mail Removed)> wrote in message
news:Y0PMd.149934$(E-Mail Removed)...
> Hi,
>
> I am using a very simple xslt file to get info from an xml document.
> The problem seems to me to be that the xml doc uses a namespace, and I
> don't know how to set up my xslt to recognize it correctly. If I remove
> the namespace specification from the xml, I can query the node I want
> perfectly. But with that namespace in there, it fails. Can someone help?
>
> Here's a simpilified version of the xml document, with that namespace
> stuff:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
> <SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
> some stuff I don't care about
> </SIgnedInfo>
> <SignatureValue>
> the stuff I want
> </SignatureValue>
> </Signature>
>
> and here's my xslt file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlnssl="http://www.w3.org/1999/XSL/Transform">
> <xslutput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
> <xsl:template match="/">
> <xsl:element name="test1">
> <xsl:value-of select="/Signature/SignatureValue"/>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
>


Never mind! I found the answer in another posting here (should have looked
first!). I changed the xslt to this, and it worked:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:MYNS=http://www.w3.org/2000/09/xmldsig#">
<xslutput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:element name="test1">
<xsl:value-of select="/MYNS:Signature/MYNS:SignatureValue"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>


Thanks anyway (esp. to those who've answered this for others, so that I
could find the answer myself!)

-Howard


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR CS0234: The type or namespace name 'DataAccessHelper' does not exist in the namespace 'BCC' (are you missing an assembly reference?) li.eddie@gmail.com ASP .Net 0 01-06-2006 11:31 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
Reaching into the default namespace when using another namespace. Jason Heyes C++ 1 11-19-2004 02:36 AM
Namespace: Is it a scope or a namespace? Anonymous C++ 3 08-18-2003 01:31 PM
Help:Why can't I use namespace System.Web? It is said that this namespace doesn't exist. But it should exist. ASP .Net 1 07-29-2003 04:31 PM



Advertisments