Use XSLT to create a Flare Topic from XML Data

XSLT is language for transforming XML documents. The World Wide Web Consortium (W3C) published XSL Transformations (XSLT)

Version 1.0 as recommendation in 1999 and XSL Transformations (XSLT) Version 2.0 in 2007. The W3C recommendations are posted at:

http://www.w3.org/TR/xslt/

http://www.w3.org/TR/xslt20/

If you are lucky enough to have information housed as XML, you are just one transformation away from a Flare topic. XSLT can be used to create XHTML files from XML files. Suppose you have this XML:

You can use XSLT to create this Flare topic:

The XSLT used is:

8 thoughts on “Use XSLT to create a Flare Topic from XML Data

  1. Tana

    Nice. How do you actually “get” the generated xhtml output into a file that can be used in Flare? I saved your example XSLT into a file called flaretopic.xsl, and your example xml into another file called jellybeans.xml, and then added to the top of jellybeans.xml. When I open jellybeans.xml in a web browser, I can see the generated output, but if I try to view source, the browser just opens up the original xml file.

    Reply
    1. Thomas Tregner Post author

      You can use an XSLT processor to generate the topic. Two options are: Saxon XSLT and XQuery Processor and Command Line Transformation Utility (msxsl.exe). The second option is from Microsoft and it is for Windows. Then you would copy the generated file into the Flare project.

      Reply
  2. Tana

    It should say that I added < ?xml-stylesheet type=”text/xsl” href=”flaretopic.xsl”? > to the top of jellybeans.xml.

    Reply
  3. Tana

    Found some answers at http://stackoverflow.com/questions/1527300/viewing-source-in-xml-to-xhtml-transformation-through-xsl though I’m still curious as to which approach you’d take.

    Reply
  4. Tim Canny

    Is it possible to use XSLT to create a whole Flare project? We currently have an automated process that takes XML through SAXON to create HTML and HTML Workshop project files which are then used to create a CHM file. It seems to me we should be able to write XSLT that can create a complete Flare project (including content files) as long as Flare doesn’t create any hidden project files we don’t know about. Or am I missing something?

    Thanks for the great resource by the way.

    Reply
    1. Thomas Tregner Post author

      You can probably accomplish that. I tend to create files and copy those into an existing project. But there is no reason you can’t create everything. Keep in mind that copies of projects are valid projects. If you have a template, you can make copies of that with Flare or outside of Flare. So some of the work can be done without XSLT. Thanks for reading!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

HTML tags are not allowed.

199,198 Spambots Blocked by Simple Comments