cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <j...@apache.org>
Subject [jira] Updated: (COCOON-1286) [PATCH] XSP - JXPath logicsheet <jxpath:for-each> using relative contexts
Date Tue, 25 Oct 2005 00:54:56 GMT
     [ http://issues.apache.org/jira/browse/COCOON-1286?page=all ]

Ralph Goers updated COCOON-1286:
--------------------------------

    Bugzilla Id:   (was: 31564)
      Component: Blocks: XSP
                     (was: Blocks: (Undefined))
    Description: 
Are you using the jpath logicsheet and have been annoyed that you can't access 
parents or siblings elements in a for-each loop?
like
<jpath:for-each select="myarray">
  <li><jpath:value-of select="/title"> - <jpath:value-of select="."></li>
</jpath:for-each>
won't work because the logicsheet changed the context and /title is not 
available.

There is a simple way to fix that, simply iterating over pointers instead of 
values. This way one can build contexts that are relative to the current one.
So . and non-absolute paths will still point to the iterated element, but 
absolute paths point to the root and siblings etc should work, too.

I wrote that patch a while ago so it is tested and works fine.

---

This patch also adds a new tag to switch the lenient setting of jxpath.
By default it is set to false. If set to true, xpaths that don't point to an 
object or a set of them will return null (Instead of that annoying exception). 
Saves all the checking if you can accept nulls and are sure there are no typos.
<jpath:set-lenient lenient="true|false">
If the tag contains child elements it will scope the setting for the enclosed 
elements, otherwise it is a global setting. You can't nest <jpath:set-lenient> 
tags.

gunnar

ps: the diff file does not have the correct path for the filenames as I had to 
use the webinterface to get the current 2.1 branch jpath.xsl.

  was:
Are you using the jpath logicsheet and have been annoyed that you can't access 
parents or siblings elements in a for-each loop?
like
<jpath:for-each select="myarray">
  <li><jpath:value-of select="/title"> - <jpath:value-of select="."></li>
</jpath:for-each>
won't work because the logicsheet changed the context and /title is not 
available.

There is a simple way to fix that, simply iterating over pointers instead of 
values. This way one can build contexts that are relative to the current one.
So . and non-absolute paths will still point to the iterated element, but 
absolute paths point to the root and siblings etc should work, too.

I wrote that patch a while ago so it is tested and works fine.

---

This patch also adds a new tag to switch the lenient setting of jxpath.
By default it is set to false. If set to true, xpaths that don't point to an 
object or a set of them will return null (Instead of that annoying exception). 
Saves all the checking if you can accept nulls and are sure there are no typos.
<jpath:set-lenient lenient="true|false">
If the tag contains child elements it will scope the setting for the enclosed 
elements, otherwise it is a global setting. You can't nest <jpath:set-lenient> 
tags.

gunnar

ps: the diff file does not have the correct path for the filenames as I had to 
use the webinterface to get the current 2.1 branch jpath.xsl.


> [PATCH] XSP - JXPath logicsheet <jxpath:for-each> using relative contexts
> -------------------------------------------------------------------------
>
>          Key: COCOON-1286
>          URL: http://issues.apache.org/jira/browse/COCOON-1286
>      Project: Cocoon
>         Type: Improvement
>   Components: Blocks: XSP
>     Versions: 2.1.8-dev (Current SVN)
>  Environment: Operating System: Windows XP
> Platform: PC
>     Reporter: Gunnar Brand
>     Assignee: Antonio Gallardo
>     Priority: Minor
>  Attachments: jpath.xsl.diff, jpath.xsl.diff
>
> Are you using the jpath logicsheet and have been annoyed that you can't access 
> parents or siblings elements in a for-each loop?
> like
> <jpath:for-each select="myarray">
>   <li><jpath:value-of select="/title"> - <jpath:value-of select="."></li>
> </jpath:for-each>
> won't work because the logicsheet changed the context and /title is not 
> available.
> There is a simple way to fix that, simply iterating over pointers instead of 
> values. This way one can build contexts that are relative to the current one.
> So . and non-absolute paths will still point to the iterated element, but 
> absolute paths point to the root and siblings etc should work, too.
> I wrote that patch a while ago so it is tested and works fine.
> ---
> This patch also adds a new tag to switch the lenient setting of jxpath.
> By default it is set to false. If set to true, xpaths that don't point to an 
> object or a set of them will return null (Instead of that annoying exception). 
> Saves all the checking if you can accept nulls and are sure there are no typos.
> <jpath:set-lenient lenient="true|false">
> If the tag contains child elements it will scope the setting for the enclosed 
> elements, otherwise it is a global setting. You can't nest <jpath:set-lenient>

> tags.
> gunnar
> ps: the diff file does not have the correct path for the filenames as I had to 
> use the webinterface to get the current 2.1 branch jpath.xsl.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message