OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Embeding application specific information within Docbook


Hi Tom,
I don't think validation is an issue, since the XSLT processors don't take the time to validate against the DTD.  Wellformedness, however, is required in order to process the content.  You should be able to put the content any place that is well formed.
 
If you want to process your content in document order, then you'll want to put it someplace where a general apply-templates element is used, so that the stylesheet can apply your custom templates.  For example, the templates with match="book" and match="article" both use an apply-templates to handle all of their content, so you should be able to put your content just inside such root elements.  Of course, it will be processed in document order, which may or may not be what you want. 
 
If you intend to process your special content by accessing the data from other templates, then you'll probably want to turn off normal document order processing and use a mode:
 
<xsl:template match="config">
  <!-- no-op in normal mode -->
</xsl:template>
 
<xsl:template match="config" mode="configuration">
  ...
</xsl:template>
 
Then you use the configuration mode when you need to access the data, which you can select with an XPath.
 
Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net
 
 
----- Original Message -----
Sent: Thursday, September 29, 2005 10:05 AM
Subject: [docbook-apps] Embeding application specific information within Docbook


I need the docbook stylesheets to be aware of certain environment variables specific to my website (weather or not the user is loged in, what permissions the user has etc.) because I need to display links (or not display links) to some of the xincluded articles dependant on these environmental factors.

My current idea is to run the article through a stylesheet, which will insert an xml representation of this environment data into the docbook document. From there I will be able to process the resulting XML document with my own customized Docbook XSL templates. (I am processing these articles on the fly using Apache AxKit - similar to Apache Cocoon and so I can use XSP processing to get this dynamic data)

The question is, where is a valid place to insert this data? It looks a little like this:

<config>
    <user>
        <userId>user id here</userId>
        <articles>
            <article>an article the user is allowed to view</article>
        </articles>
    </user>
</config>

If I embed this information somwhere into the document, are the Docbook stylesheets going to choke? Can I hide them from the Docbook stylesheets by associating them with a different namespace?

Where would be a suitable place to insert it? Ideally I'd like it just inder the root element.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]