[daisy] Getting CreatedFormatted in a custom document Styling

Bruno Dumon bruno at outerthought.org
Thu Apr 24 21:26:31 CEST 2008


Hi,

On Thu, 2008-04-24 at 14:36 -0400, Sieranski, Greg wrote:
> Steven Noels wrote:
> > On 24 Apr 2008, at 17:55, Sieranski, Greg wrote:
> >
> >> I have the following xsl for my BlogDocument:
> >>
> >> <!-- vim:set ai et fenc=utf-8 ff=unix sw=2 ts=2:-->
> >> <xsl:stylesheet version="1.0" 
> >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >>  xmlns:d="http://outerx.org/daisy/1.0">
> >>
> >>  <xsl:import href="daisyskin:/(default)xslt/document-to-html.xsl"/>
> >>  <xsl:import href="daisyskin:/(default)xslt/documentlayout.xsl"/>
> >>
> >>
> >>  <xsl:template match="d:document">
> >>  <div class="date-header">
> >>    <xsl:value-of select="$version/@createdFormatted"/>
> >>  </div>
> >>    <div class="post-title"><xsl:value-of select="@name"/></div>
> >>        <xsl:apply-templates 
> >> select="d:parts/d:part[@name='BlogAboveFoldContent']"/>
> >>        <xsl:apply-templates 
> >> select="d:parts/d:part[@name='BlogBelowFoldContent']"/>
> >>    <xsl:apply-templates select="d:links"/>
> >>    <xsl:apply-templates select="d:fields"/>
> >>  </xsl:template>
> >>
> >> </xsl:stylesheet>
> >>
> >>
> >> The line <xsl:value-of select="$version/@createdFormatted"/> is not 
> >> displaying the date. Is there something I am doing wrong?
> >
> >
> > My XSL is rapidly becoming rusty, but couldn't it be because the 
> > $version variable is declared elsewhere (in the imported stylesheets) 
> > instead of locally? Or not at all?
> >
> > </Steven>
> I have tried including:
>  <xsl:variable name="pubdoc" select="/page/p:publisherResponse/p:document"/>
>   <xsl:variable name="version" select="$pubdoc/d:version"/>
>   <xsl:variable name="document" select="$pubdoc/d:document"/>
>  
> in the document-styling but still no luck.

To know why those XPath expressions don't return anything, you need to
know what the input of the XSL transformation is. The input is an XML
document of which the general structure is shown here:

http://cocoondev.org/daisydocs-2_2/374-cd/g1/26-cd.html

The root tag is called document, so the "/page" in the XPath expression
above won't return anything. And there's only a d:document, no
d:version.

To view the complete XML that goes in your XSL transformation, add this
instruction somewhere in your XSL:

<xsl:copy-of select="/"/>

and then do view-source in your browser and look for the <document> tag.
(yep, we need more convenient ways to visualize the data which flows
through the XML pipelines)

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought                            http://www.daisycms.org/
bruno at outerthought.org              http://www.kauriproject.org/



More information about the daisy mailing list