Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 79404 invoked from network); 1 Mar 2005 18:07:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Mar 2005 18:07:00 -0000 Received: (qmail 13284 invoked by uid 500); 1 Mar 2005 18:06:56 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 12915 invoked by uid 500); 1 Mar 2005 18:06:54 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 12902 invoked by uid 99); 1 Mar 2005 18:06:54 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from smtp-vbr14.xs4all.nl (HELO smtp-vbr14.xs4all.nl) (194.109.24.34) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 01 Mar 2005 10:06:54 -0800 Received: from [10.0.0.152] (daigeert.xs4all.nl [80.127.22.250]) (authenticated bits=0) by smtp-vbr14.xs4all.nl (8.12.11/8.12.11) with ESMTP id j21I6pBP011413 for ; Tue, 1 Mar 2005 19:06:51 +0100 (CET) (envelope-from Geert.Josten@daidalos.nl) Message-ID: <4224AF3C.3030004@daidalos.nl> Date: Tue, 01 Mar 2005 19:06:52 +0100 From: Geert Josten Organization: Daidalos BV User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 To: users@cocoon.apache.org Subject: Re: include specific element with cinclude References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N > I've made various attempts to be more specific in the XPath and nothing > works. I've tried the following: > > src="http://localhost/something.xml" > select="//*[local-name()='paragraph[2]']/."/> local-name() returns the name of the element without the namespace prefix. You added a predicate test, but added it to the compare string for the local-name(). Move it to _after_ the original close bracket, like: select="//*[local-name()='paragraph'][2]" (you can drop the /. at the end) This selects _every_ second paragraph within any parent that occurs. > src="http://localhost/something.xml" > select="//*[local-name()='page']/paragraph[2]"/> This, for starters, requires that paragraph has element 'page' as parent. Moreover, it looks for 'paragraph' elements without namespace. > src="http://localhost/something.xml" > select="//*[local-name()='page']/paragraph[2]/."/> Does the same as previous.. > src="http://localhost/something.xml" > select="//*[local-name()='page/paragraph[2]']/."/> Again, you added the predicates to the compare string, that won't work > src="http://localhost/something.xml" > select="//*[local-name()='page']/paragraph/[2]"/> Illegal XPath. You can't specify a predicated directly after a /. Add at least one dot between, but it is easier just to drop the /.. :-) In short, you are looking for either: //*[local-name()='paragraph'][2] or //*[local-name()='page']/*[local-name()='paragraph'][2] Two additional notes: * //paragraph[2] is not the same as (//paragraph)[2] * Specify the namespace of paragraph in you XML that contains the cincludes and use the prefix in the select expressions. Matching through local-name() is not a good method. Cheers, Geert --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org