You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tim Williams <wi...@gmail.com> on 2006/03/27 03:40:26 UTC

Knowledge of sitemap from input module

How might I figure out what the calling sitemap is for a given input
module request?  In other words if I have: lm:my.resource, how could I
figure out that that this request happens to be coming from
some-mounted-sitemap.xmap?  We basically want this to be output for
debugging information[1].
Thanks,
--tim

[1] - http://issues.apache.org/jira/browse/FOR-770

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


Re: Knowledge of sitemap from input module

Posted by Tim Williams <wi...@gmail.com>.
On 3/27/06, peter <pe...@silmaril.ie> wrote:
> On Sun, 26 Mar 2006 20:40:26 -0500, Tim Williams wrote
> > How might I figure out what the calling sitemap is for a given input
> > module request?  In other words if I have: lm:my.resource, how could
> > I figure out that that this request happens to be coming from some-
> > mounted-sitemap.xmap?  We basically want this to be output for
> > debugging information[1].
>
> sitemap.xmap files are all XML, so (if n>1 and you know their locations),
> you could scan them in turn in XSLT with something like
>
>    <xsl:param name="myresource"/>
> ...
>    <xsl:choose>
>      <xsl:when test="document('/path/to/potential/sitemap.xmap')
>                 //map:match[contains(@pattern,$myresource)]">
>        do stuff
>      </xsl:when>
>      ...more whens...
>      <xsl:otherwise>
>        dunno how we got here
>      </xsl:otherwise>
>    </xsl:choose>
>
> But it will be fairly slow...and tedious to maintain, and you'd need to
> be able to pattern-match the @pattern, which is probably non-trivial in
> XSLT 1.0.
>
> Maybe edit your sitemaps to pass a parameter to all transformations
> identifying the location of the sitemap that matched?
>
> ///Peter
>
> ///Peter

Thank Peter, but I was really asking for within the Input Module
(java) implementation at runtime so that I can log debug lines with
it.  In other words is there some way from the environment/service
manager/etc. for me to figure out what sitemap.xmap an input module
request is coming from - inside MyInputModule.getAttribute()
Thanks,
--tim

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


Re: Knowledge of sitemap from input module

Posted by peter <pe...@silmaril.ie>.
On Sun, 26 Mar 2006 20:40:26 -0500, Tim Williams wrote
> How might I figure out what the calling sitemap is for a given input
> module request?  In other words if I have: lm:my.resource, how could 
> I figure out that that this request happens to be coming from some-
> mounted-sitemap.xmap?  We basically want this to be output for 
> debugging information[1].

sitemap.xmap files are all XML, so (if n>1 and you know their locations),
you could scan them in turn in XSLT with something like

   <xsl:param name="myresource"/>
...
   <xsl:choose>
     <xsl:when test="document('/path/to/potential/sitemap.xmap')
                //map:match[contains(@pattern,$myresource)]">
       do stuff
     </xsl:when>
     ...more whens...
     <xsl:otherwise>
       dunno how we got here
     </xsl:otherwise>
   </xsl:choose>

But it will be fairly slow...and tedious to maintain, and you'd need to
be able to pattern-match the @pattern, which is probably non-trivial in
XSLT 1.0.

Maybe edit your sitemaps to pass a parameter to all transformations
identifying the location of the sitemap that matched?

///Peter

///Peter

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