473,799 Members | 2,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Distinguishing fragments from Cocoon FragmentExtract orTransformer

If I configure and use two different fragment extractors on the
same XML document, how can I write xslt template match
patterns that distinguish which elements these fragments replaced?

Details:

My xml document contains, among other elements, two distinct
elements that need external java processing by a custom-made
Cocoon serializer that converts the contents of these elements
to "other stuff".

To extract each of these elements, I define two fragment extractors
in my sitemap:

<map:transforme r name="GoopExtra ctor"
src="org.apache .cocoon.transfo rmation.Fragmen tExtractorTrans former">
<extract-uri>GoopNamespa ce</extract-uri>
<extract-element>goop</extract-element>
</map:transformer >

<map:transforme r name="GleepExtr actor"
src="org.apache .cocoon.transfo rmation.Fragmen tExtractorTrans former">
<extract-uri>GleepNamesp ace</extract-uri>
<extract-element>gleep</extract-element>
</map:transformer >

An example xml document might contain:

...
<goop xmlns="GoopName space"/>
<goop xmlns="GoopName space"/>
<gleep xmlns="GleepNam espace"/>
...
+Lots of other elements handled directly by the stylesheet

The pipeline for the document:

<map:match pattern="**.wei rd">
<map:generate src="{1}.mxml"/>
<map:transfor m type="GoopExtra ctor"/>
<map:transfor m type="GleepExtr actor"/>
<map:transfor m type="xslt" src="stylesheet .xsl"/>
<map:serializ e type="html"/>
</map:match>

The xml seen by the stylesheet will have the goop and gleep elements
replaced by
fe:fragments. Using the sample xml with two goops and one gleep shown above,
the input to the stylesheet would be:

<fe:fragment xmlns="GoopName space"
xmlns:fe="http://apache.org/cocoon/fragmentextract or/2.0"
fragment-id="123"/>
<fe:fragment xmlns="GoopName space"
xmlns:fe="http://apache.org/cocoon/fragmentextract or/2.0"
fragment-id="456"/>
<fe:fragment xmlns="GleepNam espace"
xmlns:fe="http://apache.org/cocoon/fragmentextract or/2.0"
fragment-id="789"/>

It would be very nice if the FragmentExtract orTransformer put in an
attribute for the
element name it replaced. Something like: fragment-name="goop"
Unfortunately, this is not the case.
Note the apparently spurious default namespace defined in each fe:fragment:
This appears to be the only way to tell which element type the fragment
replaced.

Now for the problem:
I want to have two templates in the stylesheet: One that matches fragments
that replaced the goop elements
and one that matches fragments that replaced the gleep elements. How should
the match patterns be written?
To be totally concrete:

<!-- Template for goop fragments -->

<xsl:template match="fe:fragm ent?????">
<img src="cocoon/goop/{@fragment-d}.gif/>
</xsl:template>

<!-- Template for gleep fragments -->

<xsl:template match="fe:fragm ent?????">
<img src="cocoon/gleep/{@fragment-d}.gif/>
</xsl:template>

When the request for the src="..." goes back to the server, the sitemap
matches
it and processes the extracted fragments using a special serializer:

<map:match pattern="goop/*.giif">
<map:generate type="extractor " src="{1}"/>
<map:serializ e type="GoopSeria lizer"/>
</map:match>
<map:match pattern="gleep/*.gif">
<map:generate type="extractor " src="{1}"/>
<map:serializ e type="GleepSeia lizer"/>
</map:match>

The GoopSerializer and GleepSerializer are java programs I write
that transform the information in goops and gleeps into gifs.

Thanks,

Hugh Sparks, hu**@csparks.co m
Jul 20 '05 #1
0 1471

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1793
by: Adam | last post by:
Hi! I'm trying to do a login form in cocoon. Login data are taken from MySQL, but before the data are checked cocoon throws such an error: org.apache.cocoon.ResourceNotFoundException: Resource not found.: org.apache.excalibur.source.SourceNotFoundException: file:/F:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/cocoon/portal/sitemap.xmap doesn't exist. Do you have any suggestions where to check for the error? Why does the
1
2059
by: Jawahar | last post by:
Hi All.. Currently in our application, we are using Serlvet as Controller,Jsp to View,BusinessLogic in EJB. We planned to implement Cocoon frame work in our existing application. Is this Possible..? I already worked on sample xml,xslt,but i need an example where servlet or JSP would call Cocoon application to display it in the browser.
6
4819
by: Jeremy | last post by:
My requirements are very simple: When a user browses to an XML document, the server should parse the document, apply its stylesheet, and spit the HTML at the client. Apache Cocoon is a slow, bloated mess that is impossible to configure and it is just not right at all for this purpose. I have no interest whatsoever in servlets, all I need is easy-to-configure server-side XSL transformation. Has anyone come up with an apache module that...
0
1728
by: wai | last post by:
hi all, i running cocoon 2.1.1 with websphere 5, i have a problem related to xsp cinclude. everything after my first cinclude statement, it become bank. i been tested the cocoon cinclude sample code, it working fine in tomcat, but not websphere. any ideas?
0
2319
by: mcv | last post by:
I'm currently learning to use Cocoon, and although I really like it, there are a couple of things that don't seem to be explained very well. I've seen lots of articles explaining really complicated stuff with actions and selectors and stuff, but I can't find a simple explanation of how variables in the sitemap actually work. Can anyone direct me to a good article on that? Another problem I'm having is that for some strange reason, my...
0
1696
by: Per-Christian Engdal | last post by:
Hi, I have built a cocoon.war file, and deployed it on my BEA Weblogic 8.1 Sp2 (Windows 2000) installation. The deployment works without exceptions, but when I try to access cocoon through http://localhost:80/cocoon I get the following error message (stack trace): java.lang.NoClassDefFoundError: org/apache/log/Logger at org.apache.avalon.framework.logger.LogKitLogger.isWarnEnabled(LogKitLogger.java:122)
2
1658
by: rozwel | last post by:
Hi, I'm currently starting a CMS project based on XML-related technologies and I want to use an XML framework as the basis of my architecture. I found two open source project that could fit my needs : Apache Cocoon and Orbeon PresentationServer. They seem pretty equivalent in terms of what they can do (as much as I can figure it out from both tutorials I've read through) but I find it hard to decide myself because :
3
1494
by: Dennis Benzinger | last post by:
Hi! Is there a Python web publishing framework like Cocoon? I found Maki <http://maki.sourceforge.net/> but it was last updated in 2003 and its author says that he doesn't want to make another release... Bye, Dennis
0
1377
by: Hugh Field-Richards | last post by:
Hi This was original posted only on the Cocoon Users Group last year but Paloose is now reasonably mature enough for exposure on this forum. Paloose is a simplified (much simplified) version of Cocoon using PHP5. Cocoon is a means of building Web Sites using a pipelined XML/XSLT/CSS approach based on sitemaps. I have used Cocoon for
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10225
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.