[daisy] Accessing a document's fields / reading the whole XML tree
Karel Vervaeke
karel at outerthought.org
Thu May 22 18:06:42 CEST 2008
> On Thu, 2008-05-22 at 16:35 +0100, A Rocha Webmaster wrote:
> Hello all,
>
> = First question =
>
> I am trying to access a field. I've added a Description text field to
> the Attachment document; and now I want the Attachment HTML page to show
> that value in a meta name="description" field.
> <cut/>
Normally you can't access document fields in layout.xsl.
There is a workaround that lets you get access to the fields of the root
document (by which I mean the document whose ID is in the url), but not
to fields of included documents etc.
Steps to do this should be:
1. make sure the document is published as an annotatedDocument in the
publisher request
2. in documentlayout.xsl, add some additional xml elements where you
include the fields using xsl:copy-of (I don't know the incoming format
by heart, use <xsl:copy-of select="/"/> to find out).
3. in layout.xsl, pick up the fields by selecting the elements you added
earlier.
Note: I have never done this myself; I hope people will correct me if I
did not explain it right.
> = Second question =
>
> Is there a URI for the input contract? I want to be able to read the
> output of the whole XML document given a doc ID, *before* any XLST
> transformations. That would really help with the Daisy learning curve.
> If there isn't a URI, can I fetch the XML in any way? I tried
>
> <xsl:comment><xsl:copy-of select="."/></xsl:comment>
There is no such URI; A simple solution would be to add a
teeTransformer to the html-DocumentPipe in sitemap.xmap
This would allow you to write the contents of the layout.xsl input to a
file before it is actually transformed.
notes:
- This assumes you have minimal working knowledge of Cocoon
- Google for cocoon + teeTransformer for more info
- don't forget to remove the teeTransformer afterwards if you are
moving to production.
HTH,
Karel
>
> but no luck.
>
> More help, please?
>
> Júlio.
>
> _______________________________________________
> daisy community mailing list
> Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
> mail to: daisy at lists.cocoondev.org
> list information: http://lists.cocoondev.org/mailman/listinfo/daisy
More information about the daisy
mailing list