What we've done is perform all of the non-output-format transformations into an intermediate node-set. e.g.:

<xsl:varable name="letter">
   <salutation>Dear <xsl:value-of select="/xml/@name"/></salutation>
   <xsl:for-each select="./content">
      <paragraph>Here's some content <xsl:value-of select="."/></paragraph>

And then write a set of output-specific transformations

<xsl:template match="paragraph" mode="FO">
 <fo:block><xsl:value-of select="."/></fo:block>
<xsl:template match="paragraph" mode="HTML">
 <p><xsl:value-of select="."/></p>


Phillip Rhodes wrote:

I have created a html document as a result of an xsl transformation.

All of the content is contained in an xsl file (which is built dynamically from a database and programming). The content (xsl) contains a lot of xsl-commands that do variable interpolation for the report content (e.g. Dear xsl:value-of select="/xml/@name"/>) A short explanation: the reports are built up sentence by sentence based upon database data and calculations. In addition, each sentence has substitutions in it and conditional logic (e.g. pluralization)

My problem is that I want to render the document in pdf, rtf and html formats. While the html one looks good, I can not imagine how I could output in the other formats, without duplicating all the content again and putting the xsl-fo markup in the content.

What I think I should do is instead of putting anything "html-specific" in my content, to put some other markup. After I do my initial tranformation, I could then run it thorough an html convertor, or a xsl-fo convertor (to transform my markup tags).

Has anyone come up with a generic "markup" and the corresponding xsl convertors? Is this a good approach?

Thanks. I appreciate you having read this. It would be nice to get some other perspectives.


Reply via email to