cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anna Afonchenko" <>
Subject Re: XPath problems in Cocoon?
Date Mon, 24 Feb 2003 07:33:32 GMT
Thank you very much for answering and sorry to ask XSL question
on Cocoon list. But now my problem stays only in Cocoon.
I did as you advice and edited my test.xsl file to

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
<xsl:strip-space elements="*"/>
 <xsl:template match="/">
select="//a[name(following-sibling::node()[1][not(self::text() and
   <xsl:value-of select="."/>

Now, if I apply this stylesheet on html file test.html using the batch file:
c:\saxon\saxon -o outTest.xml testAnchors.html testAnchors.xsl
I get the right answer: <root>One</root> and this is great.

But when I tried to apply this stylesheet using cocoon, I still got the
empty root element <root/>
as a result.
I.e. now my stylesheet works everywhere except for Cocoon.
So I guess the problem that I have now IS with Cocoon.
So I am really sorry to ask this again, but I still don't understand this

My pipeline is:
<map:match pattern="testAnchors">
<map:generate src="ub/testing/test.html" type="html"/>
<map:transform type="xslt-saxon" src="ub/testing/test.xsl"/>
<map:serialize type="xml"/>

I would be happy to hear any suggestions.
Thank you very very much for help.


----- Original Message -----
From: "J.Pietschmann" <>
To: <>
Sent: Thursday, February 20, 2003 11:16 PM
Subject: Re: XPath problems in Cocoon?

Anna Afonchenko wrote:
> Even if the white spaces are supressed, the algorythm will stay right,
> because algorythm should check all a tags that are followed by another a
> and the only node between them MAY (not MUST) be white-space only text

The problem is here
   select="//a[name(following-sibling::node()[1][not(self::text() and
                                       ^^^^^ You select the following nodes
                                             including all text nodes
                                             ^^^^ The grab the first.
For these two nodes in the source:
  <a href="one.html">One</a>  <a href="two.html">Two</a>
MSXML gets the second <a> element node, because it strips the text
node with the space between the two <a> elements. All other
processors see this text node instead of the second <a> node at this
point and the whole select turns out empty.

Add a
  <xsl:strip-space elements="*"/>
to the beginning of your style sheet in order to get the same results
for all processors.
Alternatively, try
but perhaps you even want

BTW you should ask XSLT questions on the XSLT list:


Please check that your question  has not already been answered in the
FAQ before posting.     <>

To unsubscribe, e-mail:     <>
For additional commands, e-mail:   <>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message