cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Romayev <roma...@yahoo.com>
Subject RE: Leftover tags from I18n
Date Thu, 08 Aug 2002 10:21:10 GMT
Hi Konstantin,

I'll have to take a closer look at CInclude/XInclude
transformers...

Here is my news-summary stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="http://apache.org/cocoon/i18n/2.0">

<xsl:template match="/news">
    <div id="news-summary">
      <div class="module-header">
          <i18n:text key="news">news</i18n:text>
      </div>
    </div>
    <xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>

After running it through the transformation get this:

<?xml version="1.0" encoding="UTF-8" ?> 
 <div xmlns:i18n="http://apache.org/cocoon/i18n/2.0"
id="news-summary">
  <div class="module-header">
   <i18n:text>news</i18n:text> 
  </div>
 </div>

Cheers,
-Alex

--- Piroumian Konstantin <KPiroumian@protek.com>
wrote:
> > From: Alex Romayev [mailto:romayev@yahoo.com] 
> > 
> > Joerg, thanks very much for your help.
> > 
> > Let me try to address both points.
> > 
> > 1.Building pages from modules:
> > 
> > My home page consists of navigation, news summary,
> > coordinates summary and other page modules. 
> > Navigation module is shared by all pages.  What I
> > would like to do, is to effectively build a page
> by
> > assembling it from page modules.  It seems to make
> > sense to me, that each module should do all the
> > necessary work (transformations, logic, etc) to
> > produce the resultant html to be integrated into
> the
> > page(s) containing it.  Here is an illustrative
> > pipeline I would use for this purpose:
> > 
> > I'm matching homepage for clarity, but basically I
> > would match any page to be able to re-use the
> > navigation module.
> >      <map:match pattern="homepage">
> >         <map:aggregate element="page">
> >           <map:part
> src="cocoon:/content/navigation"/>
> >           <map:part
> src="cocoon:/content/homepage"/>
> >         </map:aggregate>
> >         <map:transform
> > src="stylesheets/simple-page2html.xsl"/>
> >         <map:transform type="i18n"/>
> >         <map:serialize/>
> >       </map:match>
> > 
> > Now assemble homepage from news summary and
> > coordinates summary modules:
> > 
> >       <map:match pattern="content/homepage">
> >         <map:aggregate element="page">
> >           <map:part
> > src="cocoon:/content/homepage/coordinates-summary"
> > element="coordinates-summary"/>
> >           <map:part
> > src="cocoon:/content/homepage/news-summary"
> > element="news-summary"/>
> >         </map:aggregate>
> >         <map:transform
> > src="stylesheets/homepage.xsl"/>
> >         <map:serialize type="xml"/>
> >       </map:match>
> > 
> >       <map:match pattern="content/homepage/*">
> >         <map:generate src="content/{1}.xml"/>
> >         <map:transform src="stylesheets/{1}.xsl"/>
> >         <map:serialize type="xml"/>
> >       </map:match>
> > 
> > Is there a better way of doing it? -- I fairly new
> to
> > Cocoon, so if there are established ways to
> getting
> > this done, I wouldn't want to re-invent the wheel
> ;) 
> 
> Your approach is very common, but remember that
> there are two ways of
> aggregating: sitemap aggregation and
> Cinclude/Xinclude transformers that
> give you more flexibility in the way you are
> aggregating (e.g.: you can use
> any structure for the aggregated content, while with
> the sitemap aggregation
> you can specify only the root element of every part.
> In most cases the
> sitemap aggregation is sufficient).
> 
> > 
> > 2. Leftover tags
> > As the result of all the transformations I get the
> > following html fragment:
> > 
> > <div
> xmlns:i18n="http://apache.org/cocoon/i18n/2.0"
> > id="news-summary">
> >   <div class="module-header">News</div>
> > </div>
> > 
> > Now it doesn't interfere with page rendering, but
> it
> > would be nice not to have it there at all… 
> 
> It's a bug somewhere and should be fixed. Having
> xmlns attribute on 'div'
> means that your 'div' element is from i18n namespace
> which is not true (it's
> from the default - XHTML/HTML - namespace). I
> suspect that you have an
> 'i18n:attr' in your 'div' element which is then
> transformed by the i18n
> transformer. If this is so then something's wrong in
> the attribute handling.
> I'll take a look at it.
> 
> But maybe the namespace appears after some XSL
> transformation, it'd be fine
> if you could investigate it and tell me about the
> results.
> 
> Konstantin
> 
> > 
> > Cheers,
> > -Alex
> > --- Joerg Heinicke <joerg.heinicke@gmx.de> wrote:
> > > Hmm, I have not enough information to see
> whether
> > > it's good or bad. It 
> > > sounds not sooo bad ;-)
> > > 
> > > If still elements with i18n namespace prefix
> remain,
> > > check whether this 
> > > prefix is bound to the correct namespace uri.
> Have a
> > > look at the XML before 
> > > the i18n transformer transforms it and look
> whether
> > > the i18n namespace 
> > > prefix is everywhere in the file bound to
> > > "http://apache.org/cocoon/i18n/2.0".
> > > 
> > > Regards,
> > > 
> > > Joerg
> > > 
> > > 
> > > Alex Romayev wrote:
> > > > Thanks Joerg,
> > > > 
> > > > You're right, it was something else and I did
> move
> > > the
> > > > i18n to be the last step -- the tags are still
> > > there,
> > > > but it doesn't seem to matter...
> > > > 
> > > > Regarding html, I'm generating
> > > "coordinates-summary"
> > > > as xhtml (hence, trasform type is "xml") and
> then
> > > > aggregating with other modules within my
> > > "homepage",
> > > > which is then aggregated with "navigation" in
> > > another
> > > > pipleline (not shown).  Is there a better way
> of
> > > doing
> > > > that?
> > > > 
> > > > 
> > > > --- Joerg Heinicke <joerg.heinicke@gmx.de>
> wrote:
> > > > 
> > > >>This works (without i18n) in general?
> > > >>
> > > >>You serialize content/coordinates-summary as
> html
> > > >>and include this in an 
> > > >>aggregation. In my understanding this can't be
> > > >>correct. Why aren't you using 
> > > >>the i18n as last transformer before *finally*
> > > >>serializing it before 
> > > >>response. In your sitemap snippet this means
> (as
> > > far
> > > >>as I can see) add it 
> > > >>between these two lines:
> > > >>
> > > >> >   <map:transform
> > > src="stylesheets/homepage.xsl"/>
> > > >> >   <map:serialize type="xml"/>
> > > >>
> > > >>Regards,
> > > >>
> > > >>Joerg
> > > >>
> > > >>
> > > >>
> > > >>Alex Romayev wrote:
> > > >>
> > > >>>Hi, I'm having problems with i18n tags left
> after
> > > >>
> > > >>I18n
> > > >>
> > > >>>Transformation.  The resultant html does not
> seem
> > > >>
> > > >>to
> > > >>
> > > >>>like them too much :)
> > > >>>
> > > >>>The following fragment uses I18nTransformer:
> > > >>>
> > > >>><map:match
> pattern="content/coordinates-summary">
> > > >>>  <map:generate
> src="content/coordinates.xml"/>
> > > >>>  <map:transform
> > > >>>src="stylesheets/coordinates-summary.xsl"/>
> > > >>>  <map:transform type="i18n"/>
> > > >>>  <map:serialize type="html"/>
> > > >>></map:match>
> > > >>>
> > > >>>coordinates-summary.xsl includes:
> > > >>>"        <a href="#"><i18n:text
> > >
> >>>key="coordinates">coordinates</i18n:text></a>"
> > > >>>
> > > >>>This fragment aggregates the results from the
> > > >>
> > > >>first
> > > >>
> > > >>>fragment and generates html.
> > > >>>
> > > >>><map:match pattern="content/homepage">
> > > >>>  <map:aggregate element="page">
> > > >>>    <map:part
> > > >>>src="cocoon:/content/coordinates-summary"
> > > >>>element="coordinates-summary"/>
> > > >>>    ...
> > > >>>  </map:aggregate>
> > > >>>  <map:transform
> src="stylesheets/homepage.xsl"/>
> > > >>>  <map:serialize type="xml"/>
> > > >>></map:match>
> > > >>>
> > > >>>Any ideas?
> > > >>>
> > > >>>Thanks,
> > > >>>-Alex
> > > 
> > > -- 
> > > 
> > > System Development
> > > VIRBUS AG
> > > Fon  +49(0)341-979-7419
> > > Fax  +49(0)341-979-7409
> > > joerg.heinicke@virbus.de
> > > www.virbus.de
> > > 
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > Please check that your question  has not already
> > > been answered in the
> > > FAQ before posting.    
> > > <http://xml.apache.org/cocoon/faq/index.html>
> > > 
> > > To unsubscribe, e-mail:    
> > > <cocoon-users-unsubscribe@xml.apache.org>
> > > For additional commands, e-mail:  
> > > <cocoon-users-help@xml.apache.org>
> > > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > Please check that your question  has not already
> been answered in the
> > FAQ before posting.    
> <http://xml.apache.org/cocoon/faq/index.html>
> > 
> > To unsubscribe, e-mail:    
> <cocoon-users-unsubscribe@xml.apache.org>
> > For additional commands, e-mail:  
> <cocoon-users-help@xml.apache.org>
> > 
> 
>
---------------------------------------------------------------------
> Please check that your question  has not already
> been answered in the
> FAQ before posting.    
> <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:    
> <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:  
> <cocoon-users-help@xml.apache.org>
> 


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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


Mime
View raw message