You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jeremy Quinn <je...@media.demon.co.uk> on 2003/03/29 18:32:37 UTC

input modules

Hi All

Is it possible to use a value from a matcher in an input module?
(I asked about this a while ago, there was some interest, but I don't 
remember what was resolved).

I need to take a URL coming into a Sitemap, pass it to an input module 
and use the returned value in the @src of a generator. ie. I am using 
an XML file to 'translate' URLs.

I have a 'linkmap' that maps incoming URL stubs to file locations (and 
describes the structure of a site).

A linkmap looks something like this:

   <map lang="en">
     <ref xl:label="home" xl:href="home.xml" xl:title="blah">
       <name>KISS</name>
       <ref xl:label="work" xl:href="work/home.xml" xl:title="blah">
         <name>Work</name>
         <ref xl:label="schematic" xl:href="work/schematic.xml" 
xl:title="blah">
           <name>Schematic</name>
         </ref>
       </ref>
       <ref xl:label="faq" xl:href="faq/home.xml" xl:title="blah">
         <name>FAQ</name>
         <ref xl:label="faq.strech" xl:href="faq/strech.xml" 
xl:title="blah">
           <name>Dil Add Freeflow</name>
         </ref>
etc.

With a pipeline like this:

<map:match pattern="*">
	<map:generate src="{linkmap:{1}}"> ???????
	etc.
</map:match>

How do you pass the "{1}" into the input module that will look up the 
URL (using XPath) in the LinkMap?

Thanks for any help

regards Jeremy


Re: input modules

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On Sunday, March 30, 2003, at 02:20 PM, Geoff Howard wrote:

> But the mechanism they use to translate a to b still seems
> analogous.  Even if (IIRC) you don't want to do this at
> transform time.  Maybe it's analogous but not useful.

OK, I take your point ;)
I'll have another look, to see if it offers yet another solution.

But my first question still stands .... did we work out a method 
whereby dynamic sitemap variables can be passed to input modules?

<snip/>

>>>> -----Original Message-----
>>>> From: Jeremy Quinn [mailto:jeremy@media.demon.co.uk]
>>>> Sent: Saturday, March 29, 2003 12:33 PM
>>>> To: cocoon-dev@xml.apache.org
>>>> Subject: input modules
>>>>
>>>>
>>>> Hi All
>>>>
>>>> Is it possible to use a value from a matcher in an input module?
>>>> (I asked about this a while ago, there was some interest, but I 
>>>> don't
>>>> remember what was resolved).
>>>>
>>>> I need to take a URL coming into a Sitemap, pass it to an input 
>>>> module
>>>> and use the returned value in the @src of a generator. ie. I am 
>>>> using
>>>> an XML file to 'translate' URLs.

<snip/>

>>>> With a pipeline like this:
>>>>
>>>> <map:match pattern="*">
>>>> 	<map:generate src="{linkmap:{1}}"> ???????
>>>> 	etc.
>>>> </map:match>
>>>>
>>>> How do you pass the "{1}" into the input module that will look up 
>>>> the
>>>> URL (using XPath) in the LinkMap?

regards Jeremy


RE: input modules

Posted by Geoff Howard <co...@leverageweb.com>.
But the mechanism they use to translate a to b still seems 
analogous.  Even if (IIRC) you don't want to do this at 
transform time.  Maybe it's analogous but not useful.

Geoff

> -----Original Message-----
> From: Jeremy Quinn [mailto:jeremy@media.demon.co.uk]
> Sent: Sunday, March 30, 2003 7:49 AM
> To: cocoon-dev@xml.apache.org
> Subject: Re: input modules
> 
> 
> 
> On Sunday, March 30, 2003, at 01:32 PM, Geoff Howard wrote:
> 
> > Isn't this what Forrest does?
> 
> If you mean LinkRewriterTransformer, no, this is different.
> 
> In my webapp, the URL is the @xl:label, with the location of the 
> content in the @xl:href. So my sitemap wants to look up the location 
> using the label, to generate the content. My 'locations' are entirely 
> private.
> 
> What I believe LRT does is to allow an author to use a label, which is 
> translated into the URL of the actual asset at render time. So the 
> label is private and the location is public. It's the other way around.
> 
> If I misunderstood what you meant about Forrest, please put me right ;)
> 
> regards Jeremy
> 
> 
> >
> > Geoff
> >
> >> -----Original Message-----
> >> From: Jeremy Quinn [mailto:jeremy@media.demon.co.uk]
> >> Sent: Saturday, March 29, 2003 12:33 PM
> >> To: cocoon-dev@xml.apache.org
> >> Subject: input modules
> >>
> >>
> >> Hi All
> >>
> >> Is it possible to use a value from a matcher in an input module?
> >> (I asked about this a while ago, there was some interest, but I don't
> >> remember what was resolved).
> >>
> >> I need to take a URL coming into a Sitemap, pass it to an input module
> >> and use the returned value in the @src of a generator. ie. I am using
> >> an XML file to 'translate' URLs.
> >>
> >> I have a 'linkmap' that maps incoming URL stubs to file locations (and
> >> describes the structure of a site).
> >>
> >> A linkmap looks something like this:
> >>
> >>    <map lang="en">
> >>      <ref xl:label="home" xl:href="home.xml" xl:title="blah">
> >>        <name>KISS</name>
> >>        <ref xl:label="work" xl:href="work/home.xml" xl:title="blah">
> >>          <name>Work</name>
> >>          <ref xl:label="schematic" xl:href="work/schematic.xml"
> >> xl:title="blah">
> >>            <name>Schematic</name>
> >>          </ref>
> >>        </ref>
> >>        <ref xl:label="faq" xl:href="faq/home.xml" xl:title="blah">
> >>          <name>FAQ</name>
> >>          <ref xl:label="faq.strech" xl:href="faq/strech.xml"
> >> xl:title="blah">
> >>            <name>Dil Add Freeflow</name>
> >>          </ref>
> >> etc.
> >>
> >> With a pipeline like this:
> >>
> >> <map:match pattern="*">
> >> 	<map:generate src="{linkmap:{1}}"> ???????
> >> 	etc.
> >> </map:match>
> >>
> >> How do you pass the "{1}" into the input module that will look up the
> >> URL (using XPath) in the LinkMap?
> >>
> >> Thanks for any help
> >>
> >> regards Jeremy
> >>
> >>
> >>
> >
> 
> 
> 

Re: input modules

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On Sunday, March 30, 2003, at 01:32 PM, Geoff Howard wrote:

> Isn't this what Forrest does?

If you mean LinkRewriterTransformer, no, this is different.

In my webapp, the URL is the @xl:label, with the location of the 
content in the @xl:href. So my sitemap wants to look up the location 
using the label, to generate the content. My 'locations' are entirely 
private.

What I believe LRT does is to allow an author to use a label, which is 
translated into the URL of the actual asset at render time. So the 
label is private and the location is public. It's the other way around.

If I misunderstood what you meant about Forrest, please put me right ;)

regards Jeremy


>
> Geoff
>
>> -----Original Message-----
>> From: Jeremy Quinn [mailto:jeremy@media.demon.co.uk]
>> Sent: Saturday, March 29, 2003 12:33 PM
>> To: cocoon-dev@xml.apache.org
>> Subject: input modules
>>
>>
>> Hi All
>>
>> Is it possible to use a value from a matcher in an input module?
>> (I asked about this a while ago, there was some interest, but I don't
>> remember what was resolved).
>>
>> I need to take a URL coming into a Sitemap, pass it to an input module
>> and use the returned value in the @src of a generator. ie. I am using
>> an XML file to 'translate' URLs.
>>
>> I have a 'linkmap' that maps incoming URL stubs to file locations (and
>> describes the structure of a site).
>>
>> A linkmap looks something like this:
>>
>>    <map lang="en">
>>      <ref xl:label="home" xl:href="home.xml" xl:title="blah">
>>        <name>KISS</name>
>>        <ref xl:label="work" xl:href="work/home.xml" xl:title="blah">
>>          <name>Work</name>
>>          <ref xl:label="schematic" xl:href="work/schematic.xml"
>> xl:title="blah">
>>            <name>Schematic</name>
>>          </ref>
>>        </ref>
>>        <ref xl:label="faq" xl:href="faq/home.xml" xl:title="blah">
>>          <name>FAQ</name>
>>          <ref xl:label="faq.strech" xl:href="faq/strech.xml"
>> xl:title="blah">
>>            <name>Dil Add Freeflow</name>
>>          </ref>
>> etc.
>>
>> With a pipeline like this:
>>
>> <map:match pattern="*">
>> 	<map:generate src="{linkmap:{1}}"> ???????
>> 	etc.
>> </map:match>
>>
>> How do you pass the "{1}" into the input module that will look up the
>> URL (using XPath) in the LinkMap?
>>
>> Thanks for any help
>>
>> regards Jeremy
>>
>>
>>
>


RE: input modules

Posted by Geoff Howard <co...@leverageweb.com>.
Isn't this what Forrest does?

Geoff

> -----Original Message-----
> From: Jeremy Quinn [mailto:jeremy@media.demon.co.uk]
> Sent: Saturday, March 29, 2003 12:33 PM
> To: cocoon-dev@xml.apache.org
> Subject: input modules
> 
> 
> Hi All
> 
> Is it possible to use a value from a matcher in an input module?
> (I asked about this a while ago, there was some interest, but I don't 
> remember what was resolved).
> 
> I need to take a URL coming into a Sitemap, pass it to an input module 
> and use the returned value in the @src of a generator. ie. I am using 
> an XML file to 'translate' URLs.
> 
> I have a 'linkmap' that maps incoming URL stubs to file locations (and 
> describes the structure of a site).
> 
> A linkmap looks something like this:
> 
>    <map lang="en">
>      <ref xl:label="home" xl:href="home.xml" xl:title="blah">
>        <name>KISS</name>
>        <ref xl:label="work" xl:href="work/home.xml" xl:title="blah">
>          <name>Work</name>
>          <ref xl:label="schematic" xl:href="work/schematic.xml" 
> xl:title="blah">
>            <name>Schematic</name>
>          </ref>
>        </ref>
>        <ref xl:label="faq" xl:href="faq/home.xml" xl:title="blah">
>          <name>FAQ</name>
>          <ref xl:label="faq.strech" xl:href="faq/strech.xml" 
> xl:title="blah">
>            <name>Dil Add Freeflow</name>
>          </ref>
> etc.
> 
> With a pipeline like this:
> 
> <map:match pattern="*">
> 	<map:generate src="{linkmap:{1}}"> ???????
> 	etc.
> </map:match>
> 
> How do you pass the "{1}" into the input module that will look up the 
> URL (using XPath) in the LinkMap?
> 
> Thanks for any help
> 
> regards Jeremy
> 
> 
> 

Re: input modules

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On Saturday, March 29, 2003, at 11:30 PM, Conal Tuohy wrote:

> Jeremy, you could try just generating the entire linkmap, then use a
> transformer to select just the part that interests you (i.e. 2 steps 
> instead
> of combined into 1 step).

yeah :)

thats what I do now ..... I am just looking at the alternatives

regards Jeremy


RE: input modules

Posted by Conal Tuohy <co...@paradise.net.nz>.
Jeremy, you could try just generating the entire linkmap, then use a
transformer to select just the part that interests you (i.e. 2 steps instead
of combined into 1 step).

> -----Original Message-----
> From: Jeremy Quinn [mailto:jeremy@media.demon.co.uk]
> Sent: Sunday, 30 March 2003 05:33
> To: cocoon-dev@xml.apache.org
> Subject: input modules
>
>
> Hi All
>
> Is it possible to use a value from a matcher in an input module?
> (I asked about this a while ago, there was some interest, but I don't
> remember what was resolved).
>
> I need to take a URL coming into a Sitemap, pass it to an
> input module
> and use the returned value in the @src of a generator. ie. I am using
> an XML file to 'translate' URLs.
>
> I have a 'linkmap' that maps incoming URL stubs to file
> locations (and
> describes the structure of a site).
>
> A linkmap looks something like this:
>
>    <map lang="en">
>      <ref xl:label="home" xl:href="home.xml" xl:title="blah">
>        <name>KISS</name>
>        <ref xl:label="work" xl:href="work/home.xml" xl:title="blah">
>          <name>Work</name>
>          <ref xl:label="schematic" xl:href="work/schematic.xml"
> xl:title="blah">
>            <name>Schematic</name>
>          </ref>
>        </ref>
>        <ref xl:label="faq" xl:href="faq/home.xml" xl:title="blah">
>          <name>FAQ</name>
>          <ref xl:label="faq.strech" xl:href="faq/strech.xml"
> xl:title="blah">
>            <name>Dil Add Freeflow</name>
>          </ref>
> etc.
>
> With a pipeline like this:
>
> <map:match pattern="*">
> 	<map:generate src="{linkmap:{1}}"> ???????
> 	etc.
> </map:match>
>
> How do you pass the "{1}" into the input module that will look up the
> URL (using XPath) in the LinkMap?
>
> Thanks for any help
>
> regards Jeremy
>
>