You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Guenther Schmidt <gu...@epost.de> on 2003/03/05 00:31:01 UTC

Namespace Problem with XPath and XSLT

Hi all,

I've aggregated a document out of a static XML file and the output of the
request generator. The top level element of the request generator output
has its own namespace (unfortunately).

In the next step of the pipeline I use an XSLT transformation on the
aggregated document.

Due to the set namespace of the request Top element I have extreme
difficulty finding the proper XPath expression so that a <xsl:template
match="reguest????????"/> could be applied.

What would the propper XPath expression be (in regard to the namespace)?

Help!!

Thanks upfront

Guenther


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: Namespace Problem with XPath and XSLT

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Guenther Schmidt wrote:
> However what did you mean with the "exclude-result-prefix-prefixes" ?

Should be exclude-result-prefixes. Look it up in the spec.

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: Namespace Problem with XPath and XSLT

Posted by Guenther Schmidt <gu...@epost.de>.
J.Pietschmann wrote:

> Guenther Schmidt wrote:
>> I've aggregated a document out of a static XML file and the output of the
>> request generator. The top level element of the request generator output
>> has its own namespace (unfortunately).
> ...
>> Due to the set namespace of the request Top element I have extreme
>> difficulty finding the proper XPath expression so that a <xsl:template
>> match="reguest????????"/> could be applied.
>> 
>> What would the propper XPath expression be (in regard to the namespace)?
> 
> FAQ. You could have been a bit more specific though.
> Declare the namespace for your request generator somewhere,
> usually this is done on the xsl:stylesheet. The prefix doesn't
> matter much, it is not necessary to use the same as in the source
> XML. You can add the prefix to the exclude-result-prefix-prefixes
> list so that your result document wouldn't be polluted.
>   <xsl:stylesheet version="..."
>     xmlns:req="uri:my:stupid:namespace" ...
> Use this prefix in match patterns:
>   <xsl:template match="req:request">...
> 
> J.Pietschmann


J. you are a genius !!!!!

Thank you very much, it worked perfectly!

However what did you mean with the "exclude-result-prefix-prefixes" ?

G�nther


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: Namespace Problem with XPath and XSLT

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Guenther Schmidt wrote:
> I've aggregated a document out of a static XML file and the output of the
> request generator. The top level element of the request generator output
> has its own namespace (unfortunately).
...
> Due to the set namespace of the request Top element I have extreme
> difficulty finding the proper XPath expression so that a <xsl:template
> match="reguest????????"/> could be applied.
> 
> What would the propper XPath expression be (in regard to the namespace)?

FAQ. You could have been a bit more specific though.
Declare the namespace for your request generator somewhere,
usually this is done on the xsl:stylesheet. The prefix doesn't
matter much, it is not necessary to use the same as in the source
XML. You can add the prefix to the exclude-result-prefix-prefixes
list so that your result document wouldn't be polluted.
  <xsl:stylesheet version="..."
    xmlns:req="uri:my:stupid:namespace" ...
Use this prefix in match patterns:
  <xsl:template match="req:request">...

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org