forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian M Dube <brian.d...@gmail.com>
Subject Re: using Subversion keyword substitution instead of published date in skin navstrip - using Forrest 0.8
Date Wed, 16 May 2007 23:59:34 GMT
Brolin Empey wrote:
> I am stuck again.

You're nearly there.

> I got the "disable-last-published" variable working by modifying the
> skinconfig DTD.
> 
> Now I am trying to get my copy of the "pelt" skin to use the value of
> my source file's "rev_id" metadata property.
> 
> Here is my source file:
> 
> ...
> <document>
>  <header>
>    <title>...</title>
>    <meta name="rev_id">$Id$</meta>
>  </header>
> ...
> 
> The "Id" keyword is not expanded because I have not yet committed the
> changes to my SVN working copy.
> 
> Here is what I have in my site's
> src/documentation/skins/pelt-brolin/xslt/html/site-to-xhtml.xsl file.
> ("pelt-brolin" is my copy of the "pelt" skin.)
> 
>  <xsl:template match="meta[@name = 'rev_id']" name="rev_id">
>    rev_id template called.
>    <xsl:value-of select="."/>
>  </xsl:template>
>  <xsl:template name="last-published">
>    <xsl:choose>
>      <xsl:when test="$config/disable-last-published = 'true'">
>        checking for rev_id metadata.
>        <xsl:if test="meta[@name = 'rev_id']">
>          calling rev_id template.
>          <xsl:call-template name="rev_id"/>
>        </xsl:if>
>        <xsl:value-of select="meta[@name = 'rev_id']"/>
> &#160;
>      </xsl:when>
>      <xsl:otherwise>
> <script type="text/javascript"><![CDATA[<!--
> document.write("]]><i18n:text >Last Published:</i18n:text><![CDATA[
"
> + document.lastModified);
> //  -->]]></script>
>      </xsl:otherwise>
>    </xsl:choose>
>  </xsl:template>
> 
> 
> I am new to XSL(T).  I have been experimenting with different
> approaches, as you can see.
> 
> What is the simplest way to have either the "last-published" or
> "rev_id" template above output the "$Id$" from my source file's
> "rev_id" metadata property?  I need a working XSL(T) example.

What you have is close. I just tested something similar.

<xsl:template name="last-published">
   <xsl:choose>
     <xsl:when test="$config/disable-last-published = 'true'">
       <xsl:if test="//meta-data/meta[@name = 'rev_id']">
         <xsl:value-of select="//meta-data/meta[@name = 'rev_id']"/>
       </xsl:if>
     </xsl:when>
     <xsl:otherwise>
       <script>...</script>
     </xsl:otherwise>
   </xsl:choose>
</xsl:template>

The omitted script in the lower part is the same as you have; the 
original last-published template content. You can use a separate 
template (your rev_id template) if you like, but this is short enough 
that I wouldn't bother.

Brian

Mime
View raw message