TimUW wrote:
> 
> We're looking to migrate from a Plone 3 site deployed via mod_transform to
> a Plone 4 site deployed via collective.xdv (plone.app.theming).  Fun
> stuff, I know :)
> 
> We currently have a large number of <xsl:template> tags scattered all over
> the place, helping us to select content out of Plone for theme transforms. 
> But, using the <xsl:template> tag seems to throw the following error:
> "XSLTParseError: element template only allowed as child of stylesheet".
> 
> Am I missing a namespace declaration or is the <xsl:template> tag no
> longer "supported"/recommended in the latest XDV/Diazo release?  Don't
> mind having to redo things, but the <xsl:template> tag sure made it easy
> to match on groups of content and then do xpath queries relative to the
> local node “created” by the template match.
> 
> Below is proof of concept code:
> 
> rules.xml
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <rules xmlns="http://namespaces.plone.org/xdv";
>            xmlns:css="http://namespaces.plone.org/xdv+css";
>            xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>            xmlns:xi="http://www.w3.org/2001/XInclude";>
>     
>     <theme href=”theme.html” />
>     ...    
>     <before theme="//*[@id='wtext']" if-content="//body[contains(concat('
> ',normalize-space(@class),' '),' section-front-page ')]">
>         <xi:include href="include.xml" />
>     </before>
>     ...
> </rules>
> 
> 
> include.xml
> 
> <rules xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>     ...
>     <xsl:template match="//*[@id='tiles-blades']" mode="initial-stage">
>       <xsl:copy-of select=".//div[@class='summary']" />
>     </xsl:template>
>     ...
> </rules>
> 
> Thanks in advance for any insight.
> 

The xinclude'd version of your rules.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<rules xmlns="http://namespaces.plone.org/xdv";
           xmlns:css="http://namespaces.plone.org/xdv+css";
           xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
           xmlns:xi="http://www.w3.org/2001/XInclude";>
    
    <theme href=”theme.html” />
    ...    
    <before theme="//*[@id='wtext']" if-content="//body[contains(concat('
',normalize-space(@class),' '),' section-front-page ')]">
        <rules xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    ...
    <xsl:template match="//*[@id='tiles-blades']" mode="initial-stage">
      <xsl:copy-of select=".//div[@class='summary']" />
    </xsl:template>
    ...
</rules>
    </before>
    ...
</rules>

You are trying to nest  rules/before/rules/xsl:template   and that doesn't
work. xsl:template's can be used with xdv, but they need to be in the top
level <rules> element.

(It would be possible to have them nested such as rules/rules/xsl:template
to facilitate xinclude of multiple templates, but it will always be
impossible to nest xsl:template within rule directives such as before, just
as you cannot nest xsl:template within xsl:template in xsl.)

Laurence
-- 
View this message in context: 
http://plone.293351.n2.nabble.com/XDV-Diazo-and-the-xsl-template-tag-tp5923593p5924710.html
Sent from the Product Developers mailing list archive at Nabble.com.
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to