Return-Path: X-Original-To: apmail-cocoon-users-archive@www.apache.org Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 858C6EE0F for ; Fri, 15 Mar 2013 19:40:53 +0000 (UTC) Received: (qmail 4704 invoked by uid 500); 15 Mar 2013 19:40:53 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 4658 invoked by uid 500); 15 Mar 2013 19:40:53 -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 List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 4647 invoked by uid 99); 15 Mar 2013 19:40:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Mar 2013 19:40:53 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jpuerto@gmail.com designates 209.85.215.42 as permitted sender) Received: from [209.85.215.42] (HELO mail-la0-f42.google.com) (209.85.215.42) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Mar 2013 19:40:46 +0000 Received: by mail-la0-f42.google.com with SMTP id fe20so4186918lab.29 for ; Fri, 15 Mar 2013 12:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=LqF1+OEsAg/cM8t/So8hxZUfJffq0/4WtHwZvy48unk=; b=0+qRyfnEqJ9jRmgR+xuZ60fYqwmKrdRwnr6BFuw8/P5CycMiOzGhKinb4jkfXJ0s1h yT0xop3cUSJgA+8NwAtlDTsTe/VCT4r25mupZqgNrJ2zZ3YSmyZYR3sQGgohGz6gzuxh Q4EoaFVaNB3Ao8G+qK/6oLXkWVl2MoPbCgMJuC+95ntE8Y5ODNkA2XiHQ0oyJgtKJwhd wgg4+uQTmue8VLX1ZipPmX+jaSdtOSTiDWiyWpXCXtuzmggj9PkSdTKuKTNAU4KmiLae AsXH7+DA+z0LRfRlaA/2Stb7/h1Xu2PkRQDK1hH7Bzf6mPsOBmFRcmVH6EeHrdU5T9rY rFRw== MIME-Version: 1.0 X-Received: by 10.152.128.98 with SMTP id nn2mr6831061lab.17.1363376424803; Fri, 15 Mar 2013 12:40:24 -0700 (PDT) Received: by 10.112.5.202 with HTTP; Fri, 15 Mar 2013 12:40:24 -0700 (PDT) In-Reply-To: References: Date: Fri, 15 Mar 2013 20:40:24 +0100 Message-ID: Subject: Re: Dom Transformer From: Javier Puerto To: users@cocoon.apache.org Content-Type: multipart/alternative; boundary=f46d042c64237ee36504d7fbcf0d X-Virus-Checked: Checked by ClamAV on apache.org --f46d042c64237ee36504d7fbcf0d Content-Type: text/plain; charset=ISO-8859-1 2013/3/15 Mansour Al Akeel > I have tags with id's like: > > > > I think this can be done is Stax, xslt or Sax, however, I am trying to > do it in a clean way without any hacks. > > Do you have any suggestion ?? > XSLT sample: You can add the following transformation to oyur pipeline sitemap.xmap: And create an xslt file that maches the elements you want to change uuid2title.xsl I hope that helps, I've not tested it. With SAX and StAX it's similar but written in java, you have to locate the element you are looking for and replace the attribute with the new one. Most times XSLT is enough, SAX and StAX is used if you have to do some business logic. DOM is not good idea because is not event based and Cocoon pipeline is based on XML events so to work with DOM you have to do double work, transform to DOM and generate SAX or StAX events later to hook the pipeline. Salu2. > > > > On Fri, Mar 15, 2013 at 2:18 PM, gelo1234 wrote: > > The question is WHY? you want DOM transformation in Cocoon environment ? > > > > Greetings, > > -Greg > > > > > > 2013/3/15 Mansour Al Akeel > >> > >> I know this may sound strange, but I like to create a transformation > with > >> DOM. > >> I was able to see Stax and Sax transformation. I was not able to see > >> one for DOM. > >> > >> Any advice ?? Examples ?? > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > >> For additional commands, e-mail: users-help@cocoon.apache.org > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org > > --f46d042c64237ee36504d7fbcf0d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

2013/3/15 Mansour Al Akeel <man= sour.alakeel@gmail.com>
I have tags with id's like:

<some-section-tag id=3D'109876_n00069" .... >

And those ids are used for links inside the document. They are linked
from different sections.
I like to transform the links and the ids to something that makes sense. Li= ke,

<xref href=3D"the-section-title-with-dashes-only" > My Link= Label</xref>

And

The anchor

<some-section-tag id=3D'the-section-title-with-dashes-only" ...= . >

I think this can be done is Stax, xslt or Sax, however, I am trying to
do it in a clean way without any hacks.

Do you have any suggestion ??

XSLT sample:

= You can add the following transformation to oyur pipeline sitemap.xmap:
=
<map:transform src=3D"resources/xslt/uuid2title.xsl"/><= br>
And create an xslt file that maches the elements you want to change uui= d2title.xsl

<xsl:template match=3D"some-section-tag/@id"= ;>
=A0 <xsl:attribute name=3D"id">
=A0=A0=A0 <x= sl:value-of select=3D"replace([your tile node xpath], " ", &= quot;")"/>
=A0 </xsl:attribute>
</xsl:template>

I hope that help= s, I've not tested it. With SAX and StAX it's similar but written i= n java, you have to locate the element you are looking for and replace the = attribute with the new one. Most times XSLT is enough, SAX and StAX is used= if you have to do some business logic.

DOM is not good idea because is not event based and Cocoon pipeline is = based on XML events so to work with DOM you have to do double work, transfo= rm to DOM and generate SAX or StAX events later to hook the pipeline.

Salu2.
=A0



On Fri, Mar 15, 2013 at 2:18 PM, gelo1234 <gelo1234@gmail.com> wrote:
> The question is WHY? you want DOM transformation in Cocoon environment= ?
>
> Greetings,
> -Greg
>
>
> 2013/3/15 Mansour Al Akeel <mansour.alakeel@gmail.com>
>>
>> I know this may sound strange, but I like to create a transformati= on with
>> DOM.
>> I was able to see Stax and Sax transformation. I was not able to s= ee
>> one for DOM.
>>
>> Any advice ?? Examples ??
>>
>> ------------------------------------------------------------------= ---
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


--f46d042c64237ee36504d7fbcf0d--