forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sina K. Heshmati (JIRA)" <j...@apache.org>
Subject [jira] Updated: (FOR-1167) class attribute of body element in XDocs source is not included in generated HTML
Date Thu, 21 May 2009 12:23:45 GMT

     [ https://issues.apache.org/jira/browse/FOR-1167?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sina K. Heshmati updated FOR-1167:
----------------------------------

    Attachment: FOR-1167-skins.patch

This patch helps transfer the class attribute from <xdoc:body> to <html:body>
for Pelt skin. The transfer is intentionally limited to @class but it's quite simple to extend
the stylesheets to convey more attributes.

Let's say we'd also like to have @onunload transfered, then we'd have to add two templates
to two stylesheets as follows:

(Step. 1.1) to $FORREST_HOME/main/webapp/skins/common/xslt/html/document-to-html.xsl

This will help copy @onunload from <xdoc:body> to <div id="content"/> that is
part of the document processed by site-to-xhtml.xsl --where <html:body> is generated.
This is not an ideal choice but adding an extra element might have broken other templates.

<xsl:template match="@onunload" mode="carry-body-attribs">
  <xsl:attribute name="onunload">
    <xsl:value-of select="."/>
   </xsl:attribute>
 </xsl:template>

(Step. 1.2) to $FORREST_HOME/main/webapp/skins/common/xslt/html/site-to-xhtml.xsl

Now, attributes are copied from <div id="content"/> to <html:body>.

  <xsl:template match="@onunload" mode="carry-body-attribs">
    <xsl:attribute name="onunload">
      <xsl:value-of select="."/>
    </xsl:attribute>
  </xsl:template>

Even though the two templates look exactly alike but they do different things. Adding i.e.
@onload might be more complicated as <html:body> already has an @onload; so carrying
attributes that already exist will require special care.

Fixing this issue for other skins would be as simple as adding two instructions to document-to-html.xsl
and site-to-xhtml.xsl of each skin.

(Step 2.1)  to $FORREST_HOME/main/webapp/skins/${SKIN-NAME}/xslt/html/document-to-html.xsl
<xsl:apply-templates select="body" mode="carry-body-attribs"/>
After <div id="content"> in <xsl:template match="document"/>

(Step 2.2) to $FORREST_HOME/main/webapp/skins/${SKIN-NAME}/xslt/html/site-to-xhtml.xsl
After <body .../> in <xsl:template match="site"/>
<xsl:call-template name="carry-body-attribs"/>

> class attribute of body element in XDocs source is not included in generated HTML
> ---------------------------------------------------------------------------------
>
>                 Key: FOR-1167
>                 URL: https://issues.apache.org/jira/browse/FOR-1167
>             Project: Forrest
>          Issue Type: Bug
>          Components: Skins (general issues)
>    Affects Versions: 0.9-dev
>            Reporter: Brolin Empey
>             Fix For: 0.9-dev
>
>         Attachments: FOR-1167-skins.patch
>
>
> Here is the body element of my XDocs source file:
> <body class="product_heading">
> The generated HTML does not include the class attribute.
> See <http://thread.gmane.org/gmane.text.xml.forrest.devel/27106>.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message