Bug 28924

Summary: [patch] Enable editing of XSLT and CSS stylesheets in authoring area
Product: Lenya Reporter: Chris Burdess <chris>
Component: Site ManagementAssignee: Lenya Developers <dev>
Status: NEW ---    
Severity: enhancement CC: dev
Priority: P3 Keywords: PatchAvailable
Version: Trunk   
Target Milestone: 2.0.1   
Hardware: All   
OS: All   
Attachments: XSLT 1.0 Relax NG grammar

Description Chris Burdess 2004-05-12 11:25:43 UTC
Further to discussions on lenya-user, I would like to propose changes to the management of 
stylesheets, such that they can be edited and managed by Lenya just like any other resource.

CSS resources must be edited using the single-form editor, unless custom CSS editor integrations are 
envisaged. However, XSLT resources can be edited using the existing XML editor integrations and a 
suitable Relax NG grammar for XSLT. James Clark's XSLT 1.0 RNG grammar from

  http://www.thaiopensource.com/relaxng/xslt.rng

is attached to this issue.
Comment 1 Chris Burdess 2004-05-12 11:26:38 UTC
Created attachment 11520 [details]
XSLT 1.0 Relax NG grammar
Comment 2 Andreas Kuckartz 2004-05-12 21:54:06 UTC
The application of the appended patch should be considered for 1.2
Comment 3 edith 2004-05-14 13:17:44 UTC
Need some more reflexions; go to 1.4
Comment 4 Gregor J. Rothfuss 2004-10-29 03:15:19 UTC
chris:

are you still interested in this? if yes i would like to give this a shot soonish.
Comment 5 Chris Burdess 2004-10-29 08:18:50 UTC
I don't actually have a requirement for this myself. I was just commenting on the architecture.
Comment 6 Gregor J. Rothfuss 2005-06-02 04:54:04 UTC
solprovider wrote on the mailing list:

> All configuration files should be editable through the GUI.  Implement
> security so content editors cannot ruin the site structure, but add
> the ability to edit CSS, XSLTs, and maybe even XMAPs.  Try to remove
> reasons anyone would need access to the file system.

Comment 7 J 2007-01-04 05:30:13 UTC
i have implemented user-editable stylesheets recently for a customer project,
and it worked out nicely.
haven't looked at edith's patch, but basically what i did was:
* create an xslt doctype with the relax ng grammer edith pointed to
* add a custom metadata field "stylesheet" to allow other doctypes to reference
a custom stylesheet
* make it editable using DAV up/download.
* tweak the sitemaps of the "real document" doctypes to look up custom xslts if
specified and use them.
Comment 8 J 2007-01-04 06:15:37 UTC
you can look at the module here:
http://people.apache.org/~nettings/lenya-1.4-modules/xslt/

in the sitemap of the document type that is to use editable xslts, i add this:

      <map:match pattern="xmldb/*/*/*/*">
        <map:generate src="lenyadoc://{1}/{2}/{4}/{3}"/>
        <map:call resource="xmldb"/>

        <map:select type="parameter">
          <map:parameter name="parameter-selector-test"
value="{stylesheet:stylesheet}"/>
          <map:when test=""/>
          <map:otherwise>
            <map:transform src="lenyadoc:/de/{stylesheet:stylesheet}">
              <map:parameter name="area" value="{2}"/>
              <map:parameter name="pub-id" value="{1}"/>
            </map:transform>
          </map:otherwise>
        </map:select>

as you can see, i'm using a custom metadata field. it is declared in an xconf
patchfile in my publication:

<xconf
    xpath="/cocoon/meta-data"
    remove="/cocoon/meta-data/component-instance[@name =
'http://whatever.org/meta']"
>
  <component-instance name="http://stackingdwarves.net/meta"
    class="org.apache.lenya.cms.metadata.ConfigurableElementSet">
    <element editable="true" name="stylesheet" multiple="false"/>
  </component-instance>
</xconf>

this could also be done by the module, but i felt uneasy about a module patching
a publication's metadata setup. but on second thought, it's probably ok and it
keeps everything in one place.