Doug's right, I think. See my comments. Also, sorry I got Kevin and Solprovider mixed up in my previous post :-)

Cheers,

-doug

On May 3, 2006, at 2:51 PM, Doug Chestnut wrote:

Hi Keven, Looks like you need to add:

<xsl:param name="nodeid" />

to your page2xhtml.xsl.

The error that you are getting for bad xslt, you are trying to access the value of the nodeid variable without declaring it as a xsl:param or xsl:variable.

HTH,
--doug

Keven Ages wrote:
This is too a "T" what I'm trying to accomplish...however, when trying
your solution I encountered a fatal error.
"Could not find variable with the name of nodeid"
org.apache.cocoon.ProcessingException: Unable to get transformer handler
for
file:/C:/apache-lenya-1.2.4/build/lenya/webapp/lenya/pubs/default/ xslt/p
age2xhtml-xhtml.xsl:
org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception in
creating Transform Handler
Perhaps I'm doing something wrong?
doctypes.xmap
-------------
<!-- pattern="{rendertype}/{area}/{doctype}/{document-path}" -->
<map:match pattern="*/*/*/**.xml">
             <map:generate src="content/{2}/{4}.xml"/>
<map:transform src="{fallback:xslt/global/{3} 2xhtml.xsl}">
               <map:parameter name="rendertype" value="{1}"/>
               <map:parameter name="nodeid"
value="{page-envelope:document-node-id}"/>

Here the parameter "nodeid" is getting passed to xhtml2xhtml.xsl in doctypes.xmap

               <map:parameter name="contextprefix"
value="http://{request-header:host}{page-envelope:context-prefix}"/>
               <map:parameter name="language"
value="{page-envelope:document-language}"/>
               <map:parameter name="page_name-image-exists"
value="{resource-exists:resources/{2}/{page-envelope:document-id}/ page_n
ame.gif}"/>
               <map:parameter name="banner-image-exists"
value="{resource-exists:resources/{2}/{page-envelope:document-id}/ banner
.jpg}"/>
             </map:transform>
             <map:transform type="xinclude"/>
         <map:serialize type="xml"/>
       </map:match>
--------------------------------------------------------------------- ---
--
xhtml2xhtml.xsl
---------------
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:xhtml="http://www.w3.org/1999/xhtml";
xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/ 1.0" xmlns="http://www.w3.org/1999/xhtml";
    xmlns:dc="http://purl.org/dc/elements/1.1/";
    exclude-result-prefixes="xhtml lenya"
    >
<xsl:param name="rendertype" select="''"/>
<xsl:param name="nodeid"/>
<xsl:param name="page_name-image-exists" select="false" />
<xsl:param name="banner-image-exists" select="false" />
[...]
--------------------------------------------------------------------- ---
---

You need to edit the publication-sitemap.xmap so that it hands down a "nodeid" parameter to page2xhtml.xsl as well. For example, here's the transformation in question from default/publication-sitemap.xmap:

 <map:transform src="xslt/page2xhtml-{4}.xsl">
<map:parameter name="root" value="{page-envelope:context-prefix}/ {2}/{3}"/>
  <map:parameter name="url" value="{5}"/>
<map:parameter name="document-id" value="{page-envelope:document- id}"/> <map:parameter name="document-type" value="{page-envelope:document- type}"/> <map:parameter name="language" value="{page-envelope:document- language}"/>

  <!-- ADD THIS: -->
<map:parameter name="nodeid" value="{page-envelope:document-node- id}"/>

</map:transform>

Then in page2xhtml, pick it up just like in xhtml2xhtml:

<xsl:param name="nodeid"/>

That should do it, I think.

We do all the image stuff in xhtml2xhtml, so we don't need to hand down the nodeid param to page2xhtml, but you'll have to if you want to use it there.

page2xhtml.xsl
--------------
<xsl:template match="cmsbody">
  <html>
    <head>
      <link rel="stylesheet" href="{$root}/css/page.css"
type="text/css"/>
      <meta content="Apache Lenya" name="generator"/>
      <meta http-equiv="Content-Type" content="application/xhtml+xml;
charset=UTF-8"/>
      <title><xsl:value-of select="//lenya:meta/dc:title"/></title>
    </head>       
    <body>
<div id="siteContainer">
<div id="dropShadowMain">
<div id="siteWrap">
<div id="logoArea"><img src="images/spacer.gif" alt="" border="0"
width="1" height="1" /></div>
<div id="navArea"><a href="about.html"><img src="images/ rgr_web_09.gif"
alt="ABOUT US" border="0" /></a><a href="services.html"><img
src="images/rgr_web_10.gif" alt="SERVICES" border="0" /></a><a
href="lawyers.html"><img src="images/rgr_web_11.gif" alt="LAWYERS"
border="0" /></a><a href="emp.html"><img src="images/rgr_web_13.gif"
alt="EMPLOYMENT OPPORTUNITIES" border="0" /></a><a href="faq.html"><img
src="images/rgr_web_15.gif" alt="FAQs" border="0" /></a><a
href="fees.html"><img src="images/rgr_web_17.gif" alt="FEES" border="0"
/></a><a href="contact.html"><img src="images/rgr_web_19.gif"
alt="CONTACT" border="0" /></a></div>
        <div id="subNav"><img src="images/spacer.gif" alt="" border="0"
width="1" height="1" /></div>
<div id="contentArea">
<img border="0">
<xsl:attribute name="src">
<xsl:value-of select="$nodeid"/>images/page_name.gif</xsl:attribute>

Looks like this parameter is not defined in this style sheet. I guess you're putting your images inside an "images" folder inside the pages corresponding resource folder, yeah?

</img>
[...]
--------------------------------------------------------------------- ---
-
Now I realize I'm probably doing something rather wrong, and I'm sure
it's an oversight on my part - so save the flaming ;)
Any idea on what I'm doing wrong? Thanks for all the help on this one
guys!
Muchos appreciated.
Keven -----Original Message-----
From: Douglas Hurbon [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 02, 2006 3:59 PM
To: [email protected]
Subject: Re: lenya basics
On May 2, 2006, at 9:24 AM, Keven Ages wrote:
Add the graphic from the XSL rather than the Document. The Document's
HTML is editable by the editors.  The XSL is only editable by
developers.


That's exactly what I'm trying to do but can't find any info on how to set up the XSLT to pull the proper graphic depending on the page they
are on.


In 1.2, you could have the graphic as an Asset attached to the
Document. That allows a common name such as "header.gif" to be used
for all Documents.  We use that technique for adding background
graphics: "bg.gif" is used if it exists.  An example Asset would be
in: {pub}/resources/live/about/header.gif

Or have a special directory for "headers" that cannot be edited using
the CMS GUI.
{pub}/headers/about/header.gif
Or for multiple languages:
{pub}/headers/about/header_en.gif


I'd love to see an example of this on the Lenya site.  Anyone?
Here you go.  From our [pub_name]/doctypes.xmap:
      <!-- parametrized doctype matcher -->
<!-- pattern="{rendertype}/{area}/{doctype}/{document- path}" -->
       <map:match pattern="*/*/*/**.xml">
             <map:generate src="content/{2}/{4}.xml"/>
<map:transform src="{fallback:xslt/global/{3} 2xhtml.xsl}">
               <map:parameter name="rendertype" value="{1}"/>
<map:parameter name="nodeid" value="{page- envelope:document-node-id}"/> <map:parameter name="contextprefix" value="http:// {request-header:host}{page-envelope:context-prefix}"/> <map:parameter name="language" value="{page- envelope:document-language}"/> <map:parameter name="page_name-image-exists" value="{resource-exists:resources/{2}/{page-envelope:document-id}/ page_name.gif}"/> <map:parameter name="banner-image-exists" value="{resource-exists:resources/{2}/{page-envelope:document-id}/ banner.jpg}"/>
             </map:transform>
             <map:transform type="xinclude"/>
         <map:serialize type="xml"/>
       </map:match>
We're passing a "true/false" string parameter for both "banner.jpg" and "page_name.gif" to the XSL stylesheet. If they exist, we use "page_name.gif" for the page title, and "banner.jpg" as the lead image. The "resource-exists" module is looking in the resource folder of the specific page for specific image names: "resources/{2}/{page- envelope:document-id}/banner.jpg", just like Keven suggested. If it finds it, it returns the string "true" if not, "false".
We pick these up in xhtml2xhtml.xsl with:
<xsl:param name="page_name-image-exists" select="false" />
<xsl:param name="banner-image-exists" select="false" />
The url of the image is constructed thus:
<img border="0">
<xsl:attribute name="src"><xsl:value-of select="$nodeid"/>/ page_name.gif</xsl:attribute>
</img>
Notice we also pass the nodeid as a parameter to the xsl page.
HTH,
-doug
Keven



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, May 01, 2006 5:47 PM
To: [email protected]
Subject: Re: lenya basics

On 5/1/06, Keven Ages <[EMAIL PROTECTED]> wrote:

I'm trying to keep my header graphics out of view of the user in Lenya

when

they are in 'edit' mode.

I'm new to Lenya and XSLT and can't seem to find any info on this on

Lenya's

site or the net.

Basically what I'm trying to do is have the header graphic update

itself

depending on the page it's on (ie, about us header graphic would

appear on

the about us page) w/o the image showing up in edit mode, so that the

user

does not change or mess with it at all.

Any help would be much appreciated - if there is any more info I can

give to

assist - please let me know.

Add the graphic from the XSL rather than the Document. The Document's
HTML is editable by the editors.  The XSL is only editable by
developers.

In 1.2, you could have the graphic as an Asset attached to the
Document.  That allows a common name such as "header.gif" to be used
for all Documents.  We use that technique for adding background
graphics: "bg.gif" is used if it exists.  An example Asset would be
in:
{pub}/resources/live/about/header.gif

Or have a special directory for "headers" that cannot be edited using
the CMS GUI.
{pub}/headers/about/header.gif
Or for multiple languages:
{pub}/headers/about/header_en.gif

solprovider

-------------------------------------------------------------------- -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-------------------------------------------------------------------- -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to