forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sjur Moshagen <sju...@mac.com>
Subject Strange XPath problems when aggregating module.properties.properties
Date Thu, 21 Aug 2008 07:00:45 GMT
Hello all,

I'm getting very strange errors after I aggregated the output from  
module.properties.properties, as suggested by Ross in [1].

Here's briefly the history of my attempts, and the XPath behaviour:

- first aggregation (in o.a.f.p.output.pdf/output.xmap):

<map:aggregate element="site">
     <map:part src="cocoon://skinconf.xml"/>
     <map:part src="cocoon://module.properties.properties"/>
     <map:part src="cocoon://{1}{2}.xml"/>
</map:aggregate>

(note, the properties module is the second part in the aggregation)

XSLT/XPath problems (in o.a.f.p.output.pdf/resources/stylesheets/ 
document-to-fo.xsl):

1)
   <xsl:variable
         name="properties"
         select="//properties" />

Expected result: all properties available as daughters of $properties
Actual result: nothing assigned to the variable

2)
   <xsl:variable
         name="properties"
         select="//@name[1]" />

Expected result: value of first @name in the document, which is found  
in the skinconfig section (ie not a property from the properties  
section)
Actual result: same as expected result

3)
   <xsl:variable
         name="properties"
         select="//@name[2]" />

Expected result: value of *second* @name in the document
Actual result: empty string

Subsequent attempts at accessing any @name beyond the first one fail.

Conclusion: I'm not able to access anything in the properties section  
of the aggregated document. But I can see all the properties if I look  
at the aggregated output directly - it is all there!

- I then change the order of aggregation:

<map:aggregate element="site">
     <map:part src="cocoon://module.properties.properties"/>
     <map:part src="cocoon://skinconf.xml"/>
     <map:part src="cocoon://{1}{2}.xml"/>
</map:aggregate>

(note, the properties module is now the *first* part in the aggregation)

The problems persist, except that I am now able to access the *first*  
property of the properties section, by using an XPath expression as in  
1) above.

4)
   <xsl:variable
         name="properties"
         select="count(//@name)" />

Expected result: the number of @name attributes in the document
Actual result:

Internal Server Error
Message: null
Description: No details available.
Sender: org.apache.cocoon.servlet.CocoonServlet
Source: Cocoon Servlet
Request URI
	index.pdf
cause
	org.apache.xpath.objects.XNumber

 From error.log:
Caused by: java.lang.ClassCastException:  
org.apache.xpath.objects.XNumber
         at  
org 
.apache 
.xpath 
.axes 
.FilterExprIteratorSimple 
.executeFilterExpr(FilterExprIteratorSimple.java:114)
         at  
org.apache.xpath.axes.FilterExprWalker.setRoot(FilterExprWalker.java: 
129)
         at  
org.apache.xpath.axes.WalkingIterator.setRoot(WalkingIterator.java:154)
         at  
org.apache.xpath.axes.LocPathIterator.asNode(LocPathIterator.java:298)
         at  
org.apache.xpath.axes.LocPathIterator.bool(LocPathIterator.java:318)
         at org.apache.xpath.XPath.bool(XPath.java:410)

This is a simple XPath expression! I really do not understand what is  
going on.

Any help or clue would be greatly appreciated - my attempts at  
improving the pdf plugin are stranded at the moment:(

Best regards,
Sjur

[1] http://marc.info/?l=forrest-dev&m=121520709107279&w=2


Mime
View raw message