[xsl] XPath to match XML from Cocoon Request Generator

Subject: [xsl] XPath to match XML from Cocoon Request Generator
From: Tim Heighes <Tim.Heighes@xxxxxxxxxxxxxxxx>
Date: Tue, 13 May 2003 14:38:35 +0100
I have created a pipeline using the Cocoon request generator that generates
XML such as this:

  <request xmlns="http://www.apache.org/coccon/requestgenerator/2.0";
           target="/cocoon/test/request" source="">
  	<header name="accept">image/gif, image/jpeg, ..., */*</header> 
  	<header name="accept-language">en-gb</header> 
  	<header name="accept-encoding">gzip, deflate</header> 
  	<header name="user-agent">Mozilla/4.0 (compatible; MSIE 6.0; Windows
NT 5.0)</header> 
  	<header name="host">localhost:8080</header> 
  	<header name="connection">Keep-Alive</header> 
    <requestParameters /> 
    <configurationParameters /> 
  <foo target="bar"/>

I what to access the target attribute of the request element.  I have used:

<xsl:value-of select="/page/request/@target"/> [1]

but this does not return anything.  I have also tried this with the request
tag as the root element, but this does not work either.

However, the following works:

<xsl:value-of select="/page/*/@target"/> [2]

I have tested [1] against the same XML as above except with the xmlns
attribute removed from the request element.  This works.

So my questions are:-

1) Why is xmlns attribute causing this happening?
2) What can I do to get around it, as I don't necessarily want to use
/page/*/@target, in case there is another child element of page with a
target attribute (e.g., /page/for/@target).

Many thanks,


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread