I've made various attempts to be more specific in the XPath and nothing
works. I've tried the following:

<cinclude:include xmlns:cinclude="http://apache.org/cocoon/include/1.0"; 
  src="http://localhost/something.xml";
select="//*[local-name()='paragraph[2]']/."/>

<cinclude:include xmlns:cinclude="http://apache.org/cocoon/include/1.0"; 
  src="http://localhost/something.xml";
select="//*[local-name()='page']/paragraph[2]"/>

<cinclude:include xmlns:cinclude="http://apache.org/cocoon/include/1.0"; 
  src="http://localhost/something.xml";
select="//*[local-name()='page']/paragraph[2]/."/>

<cinclude:include xmlns:cinclude="http://apache.org/cocoon/include/1.0"; 
  src="http://localhost/something.xml";
select="//*[local-name()='page/paragraph[2]']/."/>

<cinclude:include xmlns:cinclude="http://apache.org/cocoon/include/1.0"; 
  src="http://localhost/something.xml";
select="//*[local-name()='page']/paragraph/[2]"/>


-----Original Message-----
From: Christoph Hermann [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 01, 2005 10:29 AM
To: [email protected]
Subject: Re: include specific element with cinclude


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:

 //[EMAIL PROTECTED]'ABC123']

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

 paragraph[1]

chooses the first occurence of paragraph.

HTH
Christoph

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to