Re: XPath problems in Cocoon?
YES! That worked! Thank you very much Joerg - Original Message - From: Joerg Heinicke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 1:31 PM Subject: Re: XPath problems in Cocoon? Does this help? select=a[following-sibling::node()[normalize-space() or self::*][1][self::a]] First all non-whitespace-character text nodes and all elements are selected. From these one the first one is tested to be an a/. Regards, Joerg Anna Afonchenko wrote: Thanks for answering I agree that my expression is not the cleanest, but it doesn't work in cocoon anyway :-( I can't understand, why it is so hard to express some not-so-difficult conditions. I am trying to select all a nodes that are followed by another a node without anything in between, except white spaces. I understand that my problem is white spaces that are not ignored in any parser except for MSXML. Example: for a / a/ or a/a/ I want my expression to pick the first a. for a/texta/ or a/br/a/ I do not want my expression to pick the a. I don't want to ignore any text nodes, just the whitespace-only ones. Expression //a[following-sibling::*[1][self::a]] will select also a nodes woth some simple text in between, and I do not want it. I don't believe that this should be that complicated, but the fact is that I cannot manage to construct the expression that will choose exactly what I need, no more, no less. Sorry to drag this thread for so long, but maybe you can help me a little bit more with this and help me to find the right expression that will work in Cocoon? Thank you very very much for help. I appreciate it very much. Anna - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 24, 2003 9:21 PM Subject: Re: XPath problems in Cocoon? Anna Afonchenko wrote: But when I tried to apply this stylesheet using cocoon, I still got the empty root element root/ as a result. That's because strip-space doesn't apply if the input is delivered through a SAX pipeline (although the spec is a bit ambiguous about this. Actually, your expression is ugly. What's wrong with select=a[following-sibling::*[1][self::a]] This means select a elements where the following element (disregarding any text node) is also an a element. This is not quite equivalent to your expression but will give the same result for your XML source, and it will work regardless whether whitespace nodes are stripped. There's half a zillion other possibilities to express the same or similar conditions. If you give a description of the effect you want to achieve, a proper expression can be formulated. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XPath problems in Cocoon?
Thanks for answering I agree that my expression is not the cleanest, but it doesn't work in cocoon anyway :-( I can't understand, why it is so hard to express some not-so-difficult conditions. I am trying to select all a nodes that are followed by another a node without anything in between, except white spaces. I understand that my problem is white spaces that are not ignored in any parser except for MSXML. Example: for a / a/ or a/a/ I want my expression to pick the first a. for a/texta/ or a/br/a/ I do not want my expression to pick the a. I don't want to ignore any text nodes, just the whitespace-only ones. Expression //a[following-sibling::*[1][self::a]] will select also a nodes woth some simple text in between, and I do not want it. I don't believe that this should be that complicated, but the fact is that I cannot manage to construct the expression that will choose exactly what I need, no more, no less. Sorry to drag this thread for so long, but maybe you can help me a little bit more with this and help me to find the right expression that will work in Cocoon? Thank you very very much for help. I appreciate it very much. Anna - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 24, 2003 9:21 PM Subject: Re: XPath problems in Cocoon? Anna Afonchenko wrote: But when I tried to apply this stylesheet using cocoon, I still got the empty root element root/ as a result. That's because strip-space doesn't apply if the input is delivered through a SAX pipeline (although the spec is a bit ambiguous about this. Actually, your expression is ugly. What's wrong with select=a[following-sibling::*[1][self::a]] This means select a elements where the following element (disregarding any text node) is also an a element. This is not quite equivalent to your expression but will give the same result for your XML source, and it will work regardless whether whitespace nodes are stripped. There's half a zillion other possibilities to express the same or similar conditions. If you give a description of the effect you want to achieve, a proper expression can be formulated. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XPath problems in Cocoon?
Does this help? select=a[following-sibling::node()[normalize-space() or self::*][1][self::a]] First all non-whitespace-character text nodes and all elements are selected. From these one the first one is tested to be an a/. Regards, Joerg Anna Afonchenko wrote: Thanks for answering I agree that my expression is not the cleanest, but it doesn't work in cocoon anyway :-( I can't understand, why it is so hard to express some not-so-difficult conditions. I am trying to select all a nodes that are followed by another a node without anything in between, except white spaces. I understand that my problem is white spaces that are not ignored in any parser except for MSXML. Example: for a / a/ or a/a/ I want my expression to pick the first a. for a/texta/ or a/br/a/ I do not want my expression to pick the a. I don't want to ignore any text nodes, just the whitespace-only ones. Expression //a[following-sibling::*[1][self::a]] will select also a nodes woth some simple text in between, and I do not want it. I don't believe that this should be that complicated, but the fact is that I cannot manage to construct the expression that will choose exactly what I need, no more, no less. Sorry to drag this thread for so long, but maybe you can help me a little bit more with this and help me to find the right expression that will work in Cocoon? Thank you very very much for help. I appreciate it very much. Anna - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 24, 2003 9:21 PM Subject: Re: XPath problems in Cocoon? Anna Afonchenko wrote: But when I tried to apply this stylesheet using cocoon, I still got the empty root element root/ as a result. That's because strip-space doesn't apply if the input is delivered through a SAX pipeline (although the spec is a bit ambiguous about this. Actually, your expression is ugly. What's wrong with select=a[following-sibling::*[1][self::a]] This means select a elements where the following element (disregarding any text node) is also an a element. This is not quite equivalent to your expression but will give the same result for your XML source, and it will work regardless whether whitespace nodes are stripped. There's half a zillion other possibilities to express the same or similar conditions. If you give a description of the effect you want to achieve, a proper expression can be formulated. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XPath problems in Cocoon?
Anna Afonchenko wrote: But when I tried to apply this stylesheet using cocoon, I still got the empty root element root/ as a result. That's because strip-space doesn't apply if the input is delivered through a SAX pipeline (although the spec is a bit ambiguous about this. Actually, your expression is ugly. What's wrong with select=a[following-sibling::*[1][self::a]] This means select a elements where the following element (disregarding any text node) is also an a element. This is not quite equivalent to your expression but will give the same result for your XML source, and it will work regardless whether whitespace nodes are stripped. There's half a zillion other possibilities to express the same or similar conditions. If you give a description of the effect you want to achieve, a proper expression can be formulated. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XPath problems in Cocoon?
J.Pietschmann wrote: Actually, your expression is ugly. What's wrong with select=a[following-sibling::*[1][self::a]] This means select a elements where the following element (disregarding any text node) is also an a element. She mentioned, that no non-whitespace-character text must between the both a/s. And so it seems, that the expression must be ugly. But of course using self::a instead of name()='a' is simpler and more reliable according namespace issues. Joerg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XPath problems in Cocoon?
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 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xsl:strip-space elements=*/ xsl:template match=/ root xsl:for-each select=//a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a'] xsl:value-of select=./ /xsl:for-each /root /xsl:template /xsl:stylesheet 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: rootOne/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 issue. 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/ /map:match I would be happy to hear any suggestions. Thank you very very much for help. Anna - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] 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 tag, and the only node between them MAY (not MUST) be white-space only text node. 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.htmlOne/a a href=two.htmlTwo/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 select=//a[following-sibling::a[1][not(normalize-space())] but perhaps you even want select=//a[following-sibling::a[not(normalize-space())][1] instead. BTW you should ask XSLT questions on the XSLT list: http://www.mulberrytech.com/xsl/xsl-list/ J.Pietschmann - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XPath problems in Cocoon?
Anna What type of error message do you get in the log files? [EMAIL PROTECTED] 20/02/2003 12:40:10 Hi all. I am not sure that this message is related to Cocoon, so I apologize, if this is not appropriate here. I have a very simple html - test.html: html head titleTest anchors/title /head body ptest anchors/p a href=""One/a a href=""Two/a divseparator/div a href=""One1/a br / a href=""Two1/a divseparator/div a href=""One2/a some text a href=""Two2/a /body /html I want to choose the 'a' nodes for which first following node that is not a white-space only node is 'a' node. E.g. in the html above only the first 'a' node should be picked up. I wrote a very simple xsl - test.xsl: xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:template match="/" root xsl:for-each select="//a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a']" xsl:value-of select="."/ /xsl:for-each /root /xsl:template /xsl:stylesheet When I apply this stylesheet on my test.html using XMLSpy's XSL Transformation Tool, I get this xml: rootOne/root, e.g. it chose correctly the first a node. But when I apply this stylesheet using Cocoon, I get empty root/ as a result, e.g. in Cocoon nothing is chosen. Here is my pipeline: map:match pattern="testAnchors" map:generate src="" type="html"/ map:transform type="xslt-saxon" src=""/ map:serialize type="xml"/ /map:match Can somebody explain me what is wrong with my stylesheet and why doesn't it work using Cocoon? Thank you very much for help and sorry if this is not too much related. Best regards, Anna-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to therein originating in the organisation and the views in this message/attachments thereto are therefore not necessarily those of the CSIR and/or its employees. The sender of this e-mail is, moreover, in terms of the CSIR's Conditions of Service, subject to compliance with the CSIR's internal E-mail and Internet Policy."
Re: XPath problems in Cocoon?
Derek I don't get any error message, at least not in WEB-IN/logs/error.log I get an xml document in the browser: ?xml version="1.0" encoding="utf-8" ? root / i.e., the stylesheet was applied successfully, it just didn't match anything. Maybe my XPath expression is wrong, but then how comes it works in XMLSpy? Thanks for answering Anna - Original Message - From: Derek Hohls To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 12:51 PM Subject: Re: XPath problems in Cocoon? Anna What type of error message do you get in the log files? [EMAIL PROTECTED] 20/02/2003 12:40:10 Hi all. I am not sure that this message is related to Cocoon, so I apologize, if this is not appropriate here. I have a very simple html - test.html: html head titleTest anchors/title /head body ptest anchors/p a href=""One/a a href=""Two/a divseparator/div a href=""One1/a br / a href=""Two1/a divseparator/div a href=""One2/a some text a href=""Two2/a /body /html I want to choose the 'a' nodes for which first following node that is not a white-space only node is 'a' node. E.g. in the html above only the first 'a' node should be picked up. I wrote a very simple xsl - test.xsl: xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:template match="/" root xsl:for-each select="//a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a']" xsl:value-of select="."/ /xsl:for-each /root /xsl:template /xsl:stylesheet When I apply this stylesheet on my test.html using XMLSpy's XSL Transformation Tool, I get this xml: rootOne/root, e.g. it chose correctly the first a node. But when I apply this stylesheet using Cocoon, I get empty root/ as a result, e.g. in Cocoon nothing is chosen. Here is my pipeline: map:match pattern="testAnchors" map:generate src="" type="html"/ map:transform type="xslt-saxon" src=""/ map:serialize type="xml"/ /map:match Can somebody explain me what is wrong with my stylesheet and why doesn't it work using Cocoon? Thank you very much for help and sorry if this is not too much related. Best regards, Anna-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to therein originating in the organisation and the views in this message/attachments thereto are therefore not necessarily those of the CSIR and/or its employees. The sender of this e-mail is, moreover, in terms of the CSIR's Conditions of Service, subject to compliance with the CSIR's internal E-mail and Internet Policy."
RE: XPath problems in Cocoon?
Perhaps a trail : You use map:generate src="" type="html"/, so perhaps after the generator process, your html page is not EXACTLY the same as your static html file, and your Xpath expression fails. I think you cantrace Cocoon outputs during pipeline process as described in the documentation. Regards.Laurent -Message d'origine-De: Anna Afonchenko [mailto:[EMAIL PROTECTED]]Envoyé: jeudi 20 février 2003 12:05À: [EMAIL PROTECTED]Objet: Re: XPath problems in Cocoon? Derek I don't get any error message, at least not in WEB-IN/logs/error.log I get an xml document in the browser: ?xml version="1.0" encoding="utf-8" ? root / i.e., the stylesheet was applied successfully, it just didn't match anything. Maybe my XPath expression is wrong, but then how comes it works in XMLSpy? Thanks for answering Anna - Original Message - From: Derek Hohls To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 12:51 PM Subject: Re: XPath problems in Cocoon? Anna What type of error message do you get in the log files? [EMAIL PROTECTED] 20/02/2003 12:40:10 Hi all. I am not sure that this message is related to Cocoon, so I apologize, if this is not appropriate here. I have a very simple html - test.html: html head titleTest anchors/title /head body ptest anchors/p a href=""One/a a href=""Two/a divseparator/div a href=""One1/a br / a href=""Two1/a divseparator/div a href=""One2/a some text a href=""Two2/a /body /html I want to choose the 'a' nodes for which first following node that is not a white-space only node is 'a' node. E.g. in the html above only the first 'a' node should be picked up. I wrote a very simple xsl - test.xsl: xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:template match="/" root xsl:for-each select="//a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a']" xsl:value-of select="."/ /xsl:for-each /root /xsl:template /xsl:stylesheet When I apply this stylesheet on my test.html using XMLSpy's XSL Transformation Tool, I get this xml: rootOne/root, e.g. it chose correctly the first a node. But when I apply this stylesheet using Cocoon, I get empty root/ as a result, e.g. in Cocoon nothing is chosen. Here is my pipeline: map:match pattern="testAnchors" map:generate src="" type="html"/ map:transform type="xslt-saxon" src=""/ map:serialize type="xml"/ /map:match Can somebody explain me what is wrong with my stylesheet and why doesn't it work using Cocoon? Thank you very much for help and sorry if this is not too much related. Best regards, Anna-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to therein originating in the organisation and the views in this message/attachments thereto are therefore not necessarily those of the CSIR and/or its employees. The sender of this e-mail is, moreover, in terms of the CSIR's Conditions of Service, subject to compliance with the CSIR's internal E-mail and Internet Policy."
RE: XPath problems in Cocoon?
Good point - if your source document is well-formed XML (it does look like it) - then put an ?xml version="1.0"? at the top, renameit and try: map:generate src="" type="file"/ Derek ** I usually have "serverpages" or "file" as my type [EMAIL PROTECTED] 20/02/2003 01:12:06 Perhaps a trail : You use map:generate src="" type="html"/, so perhaps after the generator process, your html page is not EXACTLY the same as your static html file, and your Xpath expression fails. I think you cantrace Cocoon outputs during pipeline process as described in the documentation. Regards.Laurent -Message d'origine-De: Anna Afonchenko [mailto:[EMAIL PROTECTED]]Envoyé: jeudi 20 février 2003 12:05À: [EMAIL PROTECTED]Objet: Re: XPath problems in Cocoon? Derek I don't get any error message, at least not in WEB-IN/logs/error.log I get an xml document in the browser: ?xml version="1.0" encoding="utf-8" ? root / i.e., the stylesheet was applied successfully, it just didn't match anything. Maybe my XPath expression is wrong, but then how comes it works in XMLSpy? Thanks for answering Anna - Original Message - From: Derek Hohls To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 12:51 PM Subject: Re: XPath problems in Cocoon? Anna What type of error message do you get in the log files? [EMAIL PROTECTED] 20/02/2003 12:40:10 Hi all. I am not sure that this message is related to Cocoon, so I apologize, if this is not appropriate here. I have a very simple html - test.html: html head titleTest anchors/title /head body ptest anchors/p a href=""One/a a href=""Two/a divseparator/div a href=""One1/a br / a href=""Two1/a divseparator/div a href=""One2/a some text a href=""Two2/a /body /html I want to choose the 'a' nodes for which first following node that is not a white-space only node is 'a' node. E.g. in the html above only the first 'a' node should be picked up. I wrote a very simple xsl - test.xsl: xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:template match="/" root xsl:for-each select="//a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a']" xsl:value-of select="."/ /xsl:for-each /root /xsl:template /xsl:stylesheet When I apply this stylesheet on my test.html using XMLSpy's XSL Transformation Tool, I get this xml: rootOne/root, e.g. it chose correctly the first a node. But when I apply this stylesheet using Cocoon, I get empty root/ as a result, e.g. in Cocoon nothing is chosen. Here is my pipeline: map:match pattern="testAnchors" map:generate src="" type="html"/ map:transform type="xslt-saxon" src=""/ map:serialize type="xml"/ /map:match Can somebody explain me what is wrong with my stylesheet and why doesn't it work using Cocoon? Thank you very much for help and sorry if this is not too much related. Best regards, Anna-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to therein originating in the organisation and the views in this message/attachments thereto are therefore not necessarily those of the CSIR and/or its employees. The sender of this e-mail is, moreover, in terms of the CSIR's Conditions of Service, subject to compliance with the CSIR's internal E-mail and Internet Policy." -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to therein originating in the organisation and the views in this message/attachments thereto are therefore not necessarily those of the CSIR and/or its employees. The sender of this e-mail is, moreover, in terms of the CSIR's Conditions of Service, subject to compliance with the CSIR's internal E-mail and Internet Policy."
Re: XPath problems in Cocoon?
Hmm - I tried this same transform using Jame Clarke's XT program (old, but normally robust) and I got the same result - ?xml version="1.0" encoding="utf-8" ? root / I am not an XSLT guru - are you sure the syntax is not specific to XML spy?? Have you tried with some other XSLT engine? Derek [EMAIL PROTECTED] 20/02/2003 01:04:47 Derek I don't get any error message, at least not in WEB-IN/logs/error.log I get an xml document in the browser: ?xml version="1.0" encoding="utf-8" ? root / i.e., the stylesheet was applied successfully, it just didn't match anything. Maybe my XPath expression is wrong, but then how comes it works in XMLSpy? Thanks for answering Anna - Original Message - From: Derek Hohls To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 12:51 PM Subject: Re: XPath problems in Cocoon? Anna What type of error message do you get in the log files? [EMAIL PROTECTED] 20/02/2003 12:40:10 Hi all. I am not sure that this message is related to Cocoon, so I apologize, if this is not appropriate here. I have a very simple html - test.html: html head titleTest anchors/title /head body ptest anchors/p a href=""One/a a href=""Two/a divseparator/div a href=""One1/a br / a href=""Two1/a divseparator/div a href=""One2/a some text a href=""Two2/a /body /html I want to choose the 'a' nodes for which first following node that is not a white-space only node is 'a' node. E.g. in the html above only the first 'a' node should be picked up. I wrote a very simple xsl - test.xsl: xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:template match="/" root xsl:for-each select="//a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a']" xsl:value-of select="."/ /xsl:for-each /root /xsl:template /xsl:stylesheet When I apply this stylesheet on my test.html using XMLSpy's XSL Transformation Tool, I get this xml: rootOne/root, e.g. it chose correctly the first a node. But when I apply this stylesheet using Cocoon, I get empty root/ as a result, e.g. in Cocoon nothing is chosen. Here is my pipeline: map:match pattern="testAnchors" map:generate src="" type="html"/ map:transform type="xslt-saxon" src=""/ map:serialize type="xml"/ /map:match Can somebody explain me what is wrong with my stylesheet and why doesn't it work using Cocoon? Thank you very much for help and sorry if this is not too much related. Best regards, Anna-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to therein originating in the organisation and the views in this message/attachments thereto are therefore not necessarily those of the CSIR and/or its employees. The sender of this e-mail is, moreover, in terms of the CSIR's Conditions of Service, subject to compliance with the CSIR's internal E-mail and Internet Policy." -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to therein originating in the organisation and the views in this message/attachments thereto are therefore not necessarily those of the CSIR and/or its employees. The sender of this e-mail is, moreover, in terms of the CSIR's Conditions of Service, subject to compliance with the CSIR's internal E-mail and Internet Policy."
Re: XPath problems in Cocoon?
I tried it with XPathVisualizer tool, and it gives right result. But when I tried to run the stylesheet through the batch file using Saxon, I also got empty result. So I am really confused. Maybe somebody can suggest another XPath to accomplish this? I want to choose all a tags for which the first following tag that is not a white-space only text is also a tag, e.g. when there are adjacent a tags with no separate characters between them. This seems to be not too complex XPath, and the XPath that I constructed: //a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a'] seems to be rather intuitive, so I am really confused why it doesn't work. Moreover, why it DOES work in XMLSpy/XPathVisualizer and DOESN"T work with Saxon/Cocoon. I am really confused and will really appreciate any help with this issue. Thank you very much for help. Anna - Original Message - From: Derek Hohls To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 1:27 PM Subject: Re: XPath problems in Cocoon? Hmm - I tried this same transform using Jame Clarke's XT program (old, but normally robust) and I got the same result - ?xml version="1.0" encoding="utf-8" ? root / I am not an XSLT guru - are you sure the syntax is not specific to XML spy?? Have you tried with some other XSLT engine? Derek [EMAIL PROTECTED] 20/02/2003 01:04:47 Derek I don't get any error message, at least not in WEB-IN/logs/error.log I get an xml document in the browser: ?xml version="1.0" encoding="utf-8" ? root / i.e., the stylesheet was applied successfully, it just didn't match anything. Maybe my XPath expression is wrong, but then how comes it works in XMLSpy? Thanks for answering Anna - Original Message - From: Derek Hohls To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 12:51 PM Subject: Re: XPath problems in Cocoon? Anna What type of error message do you get in the log files? [EMAIL PROTECTED] 20/02/2003 12:40:10 Hi all. I am not sure that this message is related to Cocoon, so I apologize, if this is not appropriate here. I have a very simple html - test.html: html head titleTest anchors/title /head body ptest anchors/p a href=""One/a a href=""Two/a divseparator/div a href=""One1/a br / a href=""Two1/a divseparator/div a href=""One2/a some text a href=""Two2/a /body /html I want to choose the 'a' nodes for which first following node that is not a white-space only node is 'a' node. E.g. in the html above only the first 'a' node should be picked up. I wrote a very simple xsl - test.xsl: xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:template match="/" root xsl:for-each select="//a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a']" xsl:value-of select="."/ /xsl:for-each /root /xsl:template /xsl:stylesheet When I apply this stylesheet on my test.html using XMLSpy's XSL Transformation Tool, I get this xml: rootOne/root, e.g. it chose correctly the first a node. But when I apply this stylesheet using Cocoon, I get empty root/ as a result, e.g. in Cocoon nothing is chosen. Here is my pipeline: map:match pattern="testAnchors" map:generate src="" type="html"/ map:transform type="xslt-saxon" src=""/ map:serialize type="xml"/ /map:match Can somebody explain me what is wrong with my stylesheet and why doesn't it work using Cocoon? Thank you very much for help and sorry if this is not too much related. Best regards, Anna-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to therein originating in the organisation and the views in this message/attachments thereto are therefore not necessarily those of the CSIR and/or its employees. The sender of this e-mail is, moreover, in terms of the CSIR's Conditions of Service, subject to compliance with the CSIR's internal E-mail and Internet Policy." -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to t
Re: XPath problems in Cocoon?
I tried it with XPathVisualizer tool, and it gives right result. But when I tried to run the stylesheet through the batch file using Saxon, I also got empty result. So I am really confused. Maybe somebody can suggest another XPath to accomplish this? I want to choose all a tags for which the first following tag that is not a white-space only text is also a tag, e.g. when there are adjacent a tags with no separate characters between them. This seems to be not too complex XPath, and the XPath that I constructed: //a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a'] seems to be rather intuitive, so I am really confused why it doesn't work. Moreover, why it DOES work in XMLSpy/XPathVisualizer and DOESN"T work with Saxon/Cocoon. I am really confused and will really appreciate any help with this issue. Thank you very much for help. Anna - Original Message - From: Derek Hohls To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 1:27 PM Subject: Re: XPath problems in Cocoon? Hmm - I tried this same transform using Jame Clarke's XT program (old, but normally robust) and I got the same result - ?xml version="1.0" encoding="utf-8" ? root / I am not an XSLT guru - are you sure the syntax is not specific to XML spy?? Have you tried with some other XSLT engine? Derek [EMAIL PROTECTED] 20/02/2003 01:04:47 Derek I don't get any error message, at least not in WEB-IN/logs/error.log I get an xml document in the browser: ?xml version="1.0" encoding="utf-8" ? root / i.e., the stylesheet was applied successfully, it just didn't match anything. Maybe my XPath expression is wrong, but then how comes it works in XMLSpy? Thanks for answering Anna - Original Message - From: Derek Hohls To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 12:51 PM Subject: Re: XPath problems in Cocoon? Anna What type of error message do you get in the log files? [EMAIL PROTECTED] 20/02/2003 12:40:10 Hi all. I am not sure that this message is related to Cocoon, so I apologize, if this is not appropriate here. I have a very simple html - test.html: html head titleTest anchors/title /head body ptest anchors/p a href=""One/a a href=""Two/a divseparator/div a href=""One1/a br / a href=""Two1/a divseparator/div a href=""One2/a some text a href=""Two2/a /body /html I want to choose the 'a' nodes for which first following node that is not a white-space only node is 'a' node. E.g. in the html above only the first 'a' node should be picked up. I wrote a very simple xsl - test.xsl: xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:template match="/" root xsl:for-each select="//a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a']" xsl:value-of select="."/ /xsl:for-each /root /xsl:template /xsl:stylesheet When I apply this stylesheet on my test.html using XMLSpy's XSL Transformation Tool, I get this xml: rootOne/root, e.g. it chose correctly the first a node. But when I apply this stylesheet using Cocoon, I get empty root/ as a result, e.g. in Cocoon nothing is chosen. Here is my pipeline: map:match pattern="testAnchors" map:generate src="" type="html"/ map:transform type="xslt-saxon" src=""/ map:serialize type="xml"/ /map:match Can somebody explain me what is wrong with my stylesheet and why doesn't it work using Cocoon? Thank you very much for help and sorry if this is not too much related. Best regards, Anna-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to therein originating in the organisation and the views in this message/attachments thereto are therefore not necessarily those of the CSIR and/or its employees. The sender of this e-mail is, moreover, in terms of the CSIR's Conditions of Service, subject to compliance with the CSIR's internal E-mail and Internet Policy." -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. "The CSIR exercises no editorial control over E-mail messages and/or attachments thereto/links referred to t
Re: XPath problems in Cocoon?
Even if the white spaces are supressed, the algorythm will stay right, because algorythm should check alla tags that are followed by another a tag, and the only node between them MAY (not MUST) be white-space only text node. Whatever the generator will do to the input file, it cannot possibly insert some non-space characters between two a tags that in the input file were separated just by white-space, so the algorythmshould still give the right answer. But since I indeed do not knowhow the input document will be rendered after going through generator, and moreover, through JTidy, I cannot rely on the fact that threre will be no whitespaces between two adjacent anchor tags, thus, I cannot just say in my XPath"choose all a tags for which the first following node is also an a tag", because for the case with not suppressed whitespaces, it will return wrong answers. There are some parsers that ingnore white space only nodes, so for them I wouldn't need to bother, but I use Saxon parser, and it considers white-space as a node, and I already encountered few cases where it mattered. Conclusion: I must check for presence of white spaces and whether they are present or not, return correct answer, all a tags that have adjacent a tag,i.e. first following tag that is not white space is a tag. Sorry, I know that this is not too much related to Cocoon, but this really frustrates me - WHAT should be the right XPath for this not-so-hard case to work in Cocoon??! Maybe somebody can give some idea? I really appreciate all your help. Thank you very much for answering. Anna - Original Message - From: Laurent Comte To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 2:18 PM Subject: RE: XPath problems in Cocoon? Not the answer but ... Are you obliged to base your algorithm on the presence of whitespaces ? If your html file is like : a href=""One/a a href=""Two/a , Iwon't bet a cent on how it will be rendered after the generator process ... Perhaps they will be suppressed, or what else ? ... And perhaps I didn't understood what you want to get exactly ... Laurent. -Message d'origine-De: Anna Afonchenko [mailto:[EMAIL PROTECTED]]Envoyé: jeudi 20 février 2003 12:57À: cocoon-usersObjet: Re: XPath problems in Cocoon? I tried it with XPathVisualizer tool, and it gives right result. But when I tried to run the stylesheet through the batch file using Saxon, I also got empty result. So I am really confused. Maybe somebody can suggest another XPath to accomplish this? I want to choose all a tags for which the first following tag that is not a white-space only text is also a tag, e.g. when there are adjacent a tags with no separate characters between them. This seems to be not too complex XPath, and the XPath that I constructed: //a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a'] seems to be rather intuitive, so I am really confused why it doesn't work. Moreover, why it DOES work in XMLSpy/XPathVisualizer and DOESN"T work with Saxon/Cocoon. I am really confused and will really appreciate any help with this issue. Thank you very much for help. Anna - Original Message - From: Derek Hohls To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 1:27 PM Subject: Re: XPath problems in Cocoon? Hmm - I tried this same transform using Jame Clarke's XT program (old, but normally robust) and I got the same result - ?xml version="1.0" encoding="utf-8" ? root / I am not an XSLT guru - are you sure the syntax is not specific to XML spy?? Have you tried with some other XSLT engine? Derek [EMAIL PROTECTED] 20/02/2003 01:04:47 Derek I don't get any error message, at least not in WEB-IN/logs/error.log I get an xml document in the browser: ?xml version="1.0" encoding="utf-8" ? root / i.e., the stylesheet was applied successfully, it just didn't match anything. Maybe my XPath expression is wrong, but then how comes it works in XMLSpy? Thanks for answering Anna - Original Message - From: Derek Hohls To: [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 12:51 PM Subject: Re: XPath problems in Cocoon? Anna What type of error message do you get in the log files? [EMAIL PROTECTED] 20/02/2003 12:40:10 Hi all. I
Re: XPath problems in Cocoon?
Hi Anna, XMLSpy and XPathVisualizer probably use MSXML (unless you mean the Mozilla version of XPathVisualizer), so I guess this is a XSLT processor issue. I would suggest to forward your question to an XSLT specific group, as it is more likely to find an alternative solution there. Manos Anna Afonchenko wrote: I tried it with XPathVisualizer tool, and it gives right result. But when I tried to run the stylesheet through the batch file using Saxon, I also got empty result. So I am really confused. Maybe somebody can suggest another XPath to accomplish this? I want to choose all a tags for which the first following tag that is not a white-space only text is also a tag, e.g. when there are adjacent a tags with no separate characters between them. This seems to be not too complex XPath, and the XPath that I constructed: //a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a'] seems to be rather intuitive, so I am really confused why it doesn't work. Moreover, why it DOES work in XMLSpy/XPathVisualizer and DOESNT work with Saxon/Cocoon. I am really confused and will really appreciate any help with this issue. Thank you very much for help. Anna - Original Message - *From:* Derek Hohls mailto:[EMAIL PROTECTED] *To:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] *Sent:* Thursday, February 20, 2003 1:27 PM *Subject:* Re: XPath problems in Cocoon? Hmm - I tried this same transform using Jame Clarke's XT program (old, but normally robust) and I got the same result - ?xml version=1.0 encoding=utf-8 ? * * root / I am not an XSLT guru - are you sure the syntax is not specific to XML spy?? Have you tried with some other XSLT engine? Derek [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 20/02/2003 01:04:47 Derek I don't get any error message, at least not in WEB-IN/logs/error.log I get an xml document in the browser: ?xml version=1.0 encoding=utf-8 ? * * root / i.e., the stylesheet was applied successfully, it just didn't match anything. Maybe my XPath expression is wrong, but then how comes it works in XMLSpy? Thanks for answering Anna - Original Message - *From:* Derek Hohls mailto:[EMAIL PROTECTED] *To:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] *Sent:* Thursday, February 20, 2003 12:51 PM *Subject:* Re: XPath problems in Cocoon? Anna What type of error message do you get in the log files? [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 20/02/2003 12:40:10 Hi all. I am not sure that this message is related to Cocoon, so I apologize, if this is not appropriate here. I have a very simple html - test.html: html head titleTest anchors/title /head body ptest anchors/p a href=one.htmlOne/a a href=two.htmlTwo/a divseparator/div a href=one.htmlOne1/a br / a href=two.htmlTwo1/a divseparator/div a href=one.htmlOne2/a some text a href=two.htmlTwo2/a /body /html I want to choose the 'a' nodes for which first following node that is not a white-space only node is 'a' node. E.g. in the html above only the first 'a' node should be picked up. I wrote a very simple xsl - test.xsl: xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xsl:template match=/ root xsl:for-each select=//a[name(following-sibling::node()[1][not(self::text() and normalize-space())])='a'] xsl:value-of select=./ /xsl:for-each /root /xsl:template /xsl:stylesheet When I apply this stylesheet on my test.html using XMLSpy's XSL Transformation Tool, I get this xml: rootOne/root, e.g. it chose correctly the first a node. But when I apply this stylesheet using Cocoon, I get empty root/ as a result, e.g. in Cocoon nothing is chosen. Here is my pipeline: 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/ /map:match Can somebody explain me what is wrong with my stylesheet and why doesn't it work using Cocoon? Thank you very much for help and sorry if this is not too much related. Best regards, Anna -- This message has been scanned for viruses and dangerous content by *MailScanner* http://www.mailscanner.info/, and is believed to be clean. The CSIR exercises no editorial control over E-mail messages
Re: XPath problems in Cocoon?
Anna, I didn't pick up whether you have experimented with the fact that your pipeline begins with an HTML generator. You could build yourself a simple pipeline: map:match pattern=xxx map:generate type=html src=/ map:serialize type=xml/ /map:match Use that to convert your source HTML into XML (file/save on your browser). Then try using that XML in XML spy. Does it still work? The HTML generator does convert badly formatted HTML into correct HTML, so it can slightly change the structure of the document (it is based upon JTidy, which exists for that purpose). Regards, Upayavira - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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 tag, and the only node between them MAY (not MUST) be white-space only text node. 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.htmlOne/a a href=two.htmlTwo/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 select=//a[following-sibling::a[1][not(normalize-space())] but perhaps you even want select=//a[following-sibling::a[not(normalize-space())][1] instead. BTW you should ask XSLT questions on the XSLT list: http://www.mulberrytech.com/xsl/xsl-list/ J.Pietschmann - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]