On Thu, 2005-12-08 at 09:46 +0100, Roman Mario Xerxes Rometsch wrote:
> Hi,
> can someone give me a hint, how i can reference an image in my css file?
> The image location is {pub}/images/saeulen.png, but in my css file I have
> no variable {$root}. The relative uri images/saeulen.png does not work.
You can create an xml file with the same name as your css file, e.g:
foo.css (just an empty file)
foo.xml (contains the css inside of an <css>...</css> element)
Lenya will then use the xml file to generate the css, and the parameters
like context-prefix, pub-id etc. can be used in the xml.
Have a look at src/webapp/lenya/resources/css/menu.xml to see how it
works.
It requires that your css is stored at
yourpub/resources/shared/css/
And the images should be at
yourpub/resources/shared/images/
The relevant pipeline is defined in resources-shared.xmap:
<!-- matches pub-id/area/css/*.css -->
<map:match pattern="*/*/css/*.css">
<map:act type="resource-exists"
src="pubs/{1}/resources/shared/css/{3}.xml">
<map:generate
src="pubs/{../1}/resources/shared/css/{../3}.xml"/>
<map:transform src="resources/css/css.xsl">
<map:parameter name="contextprefix"
value="{request:contextPath}"/>
<map:parameter name="publicationid"
value="{page-envelope:publication-id}"/>
<map:parameter name="area" value="{page-envelope:area}"/>
</map:transform>
<map:serialize type="text" mime-type="text/css"/>
</map:act>
<map:read src="pubs/{1}/resources/shared/css/{3}.css"
mime-type="text/css" />
</map:match>
hth,
Josias
>
> Thanks
>
> Mario Rometsch
>
> ---------------------------------------------------------------------
> 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]