Hi, 
I have a similar issue, could anyone clarify this here.
I have an XML document where a particular elemnt is defined under a given
namespace.Now I want to give this namespace in my XPATH expr (without
declaring in the XSLT).
One trick I did was to use an XPATH expr looking something like this,
//*[namespace::asx='http://www.sap.com/abapxml' local-name()='abap'  for
locating an element "abap" declared under a namespace
'http://www.sap.com/abapxml' with prefix "asx".

I wanted to clarify if this is the right approach??? Is there any other way
of approaching the same issue.

Regards,
Ankur

-----Original Message-----
From: David Marston/Cambridge/IBM [mailto:[EMAIL PROTECTED]
Sent: Monday, April 29, 2002 7:50 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Problems with default namespace in XML input document



>I have an XML input document where the default namespace is bound
>somewhere,...
>If I take the 'xmlns' binding off the input document, [my select of an
>unprefixed element name] works.
>Also,  if I use a prefix, and put the binding back on but using the
prefix,
>and bind that prefix in the xsl stylesheet, it works.
>Can anyone tell me why?

You have encountered a famous XPath FAQ. I think you can find some
explanation in Dave Pawson's XSLT FAQ website. The quick answer is
that select="mydoc" in XPath means non-namespaced "mydoc" elements.

>I  am  writing an application where I am expecting XML documents to be
>sent to me where the default namespace will be bound,...

If that namespace is known and unvarying, use a namespace prefix in
your stylesheet. If you can't be sure about the namespace, there are
a few tricks possible, but you need to review the overall design.
.................David Marston

Reply via email to