Missing semicolon. It also works
relatively doing ../..
From: Mato Mira, Fernando (DIA CHE)
Sent: Thursday, April 06, 2006
4:03 PM
To: users@cocoon.apache.org
Subject: RE: overriding CForms
xslt and css?
I applied this technique successfully,
however there is one missing point:
How does one do to write a minimal css
with only the overrides and that imports from forms.css in the classpath?
I tried an @import, even an absolute URI
with everything except the server name, and it’s not getting
the missing definitions from forms.css.
My sitemap does match
“resources” to the classpath in the usual way (it is working for
the rest).
Thanks
From: Simone Gianni [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 05, 2006
2:24 PM
To: users@cocoon.apache.org
Subject: Re: overriding CForms
xslt and css?
Hi Fernando,
I usually override templates i need to customize in a different XSL that
includes the default ones.
For example, if I want to be able to specify a fi:styling/@note attribute to
show a small note under a field label, i can do it this way :
myproject-forms-styling.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:bu="http://apache.org/cocoon/browser-update/1.0"
exclude-result-prefixes="fi">
<xsl:include href=""
href="resource://org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl">"resource://org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl"/>
<!-- Location of the resources directory, where JS libs and icons are
stored -->
<xsl:param name="resources-uri"/>
<xsl:template match="fi:*" mode="label">
<!-- Copy the fi:* mode label template from
forms-field-styling.xsl -->
<xsl:param name="id"/>
<xsl:variable name="resolvedId">
<xsl:choose>
<xsl:when test="$id !=
''"><xsl:value-of select="$id"/></xsl:when>
<xsl:otherwise><xsl:value-of select="concat(@id,
':input')"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<label for=""
title="{fi:hint}">
<xsl:apply-templates select="."
mode="css"/>
<xsl:copy-of
select="fi:label/node()"/>
</label>
<!-- Add my own part -->
<xsl:if test="(string(fi:styling/@note) != '') and
string(@state) != 'output'">
<br/>
<i><i18n:text><xsl:value-of
select="fi:styling/@note"/></i18n:text></i>
</xsl:if>
<!-- End of my part -->
</xsl:template>
If could even be easier this way :
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:bu="http://apache.org/cocoon/browser-update/1.0"
exclude-result-prefixes="fi">
<xsl:import href=""
href="resource://org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl">"resource://org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl"/>
<!-- Location of the resources directory, where JS libs and icons are
stored -->
<xsl:param name="resources-uri"/>
<xsl:template match="fi:*" mode="label">
<xsl:apply-imports/>
<!-- Add my own part -->
<xsl:if test="(string(fi:styling/@note) != '') and
string(@state) != 'output'">
<br/>
<i><i18n:text><xsl:value-of
select="fi:styling/@note"/></i18n:text></i>
</xsl:if>
<!-- End of my part -->
</xsl:template>
But unfortunately this often does not work as expected, because default cocoon
XSLs are designed to be included and not imported in another stylesheet.
Also, mind priorities. If your template is not called when transforming, it
could be because of XSL priorities, in that case add priority="20" to
your templates to force them to be at highest priority, for example :
<xsl:template match="fi:*" mode="label"
priority="20">
....
Hope this helps,
Simone
[EMAIL PROTECTED]
wrote:
I need to provide a different look for the tabs
(using images).
What is the right way to override some but not all of
the CForms xslt and css files?
There is this {$resources-uri} everywhere.
Thanks
--
Simone Gianni