cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Hermann <christoph.herm...@tu-clausthal.de>
Subject Re: include specific element with cinclude
Date Tue, 01 Mar 2005 16:29:19 GMT
Schultz, Gary - COMM schrieb:

Hello,

> I have cinclude working so that I can get all of the specific
> elements from an XML file. What I have not found a way to do is get
> the 2nd, 3rd, 4th, etc. element or get an element by attribute value.
> I have found nothing in Cocoon wiki to explain how one uses cinclude
> to include only a part of the XML file.
>
> For example, I can use the following to get all paragraph elements in
> an xml file:
>
> <cinclude:include
> xmlns:cinclude="http://apache.org/cocoon/include/1.0"
> src="http://localhost/something.xml"
> select="//*[local-name()='paragraph']/."/>
>
> But what I want is to get a specific paragraph element from the file.
> Any direction on this is greatly appreciated.

You need to be more precise in your xpath expression:

 //paragraph[@var='ABC123']

chooses all paragraphs with an attribute var that equals 'ABC123'.

 paragraph[1]

chooses the first occurence of paragraph.

HTH
Christoph

Mime
View raw message