Oh dear.
On doing some research I turned up this page : 
http://issues.apache.org/jira/browse/JCR-579
which makes it sound as if it's not possible to use digit based names in xpath queries. From what I can tell that means that paragraph numbers can't be included in xPath queries, which means that the handle I get for the current paragraph would have to be munged to escape all the paragraph numbers as specified in section 6.4.3of the JCR spec - more than painful.

Please tell me this isn't true.

If I'm understanding correctly then using numbers for paragraphs renders xpath queries virtually unusable for a huge class of use cases - It seems crazy if this is the case, after all it would be very easy to just create the paragraphs with names like "para00", "para01" etc. and side step the problem completely. What am I misunderstanding here ?

cheers,
Josh

On 21 May 2008, at 03:17, joshua portway wrote:

I think I spoke a little too soon - the handle I'm getting pack for the current paragraph is like this :

/home/column1/0

the problem is that the paragraph number ("0" in the example above) seems not to work with xpath queries. I have "image" paragraphs attached as nested paragraphs to the main paragraphs in the column. If i do a query like :
//home/column1//image

then i get results back that look like this :
/home/column1/0/images/0
/home/column1/0/images/00

which seem to be the handles for the two images attached to he first paragraph in column1. The problem is that obviously that queryu as it stands will return the images attached to *any* paragraph in column1, not just the current one.

if I search for "//home/column1/0//image" then I don't get back any results at all. The "0" paragraph number seem to be messing things up. What am I doing wrong ?

Also - in these examples "home" is the name of the page I'm working with - it's at the top of my website, but it doesn't seem to be at the top of the JCR repository, even though in the browser it looks like that (I have to put "//" in front of the quiry to get it to work) - I assume that putting a wildcard at the front of my query isn't great for performance, what should I put at the front, above my page name ?

thanks,
Josh




On 21 May 2008, at 02:22, Ruben Reusser wrote:

Josh:

<jsp:root version="1.2"
xmlns:cmsfn="http://www.magnolia.info/tlds/cmsfn-taglib.tld";
..>
Act Page: ${cmsfn:currentPage().handle}
Act Paragraph ${cmsfn:currentParagraph()}

will give you the handle of the current page (path) - you should be able to create your query from that.

see also http://jira.magnolia.info/browse/MAGNOLIA-1647

Ruben Reusser
[EMAIL PROTECTED]
http://www.headwire.com

joshua portway wrote:
Hi,
I'm sure the answer to this question is really simple, but I can't find it anywhere - I'm trying to use a <cms:query> tag to query the descendants of the current paragraph (nested paragraphs) from its paragraph template. How can I do this, since the query tag always seems to query from the repository root node, and doesn't seem to know about the context? I assume that if I could get the path to the current paragraph I could prepend this to the query string, but I don't actually know how to get hold of that either, without resorting to scriptlets, and that seems kind of hacky so I'm sure there must be a better way...

Josh



----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------



----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------



----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------

Reply via email to