Re: [xsl] regexs, grouping (?) and XSLT2?

Subject: Re: [xsl] regexs, grouping (?) and XSLT2?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 11 Aug 2004 16:01:41 +0100
Hi Bruce,

>> I'd really like to make the stylesheet configurable via an XML style
>> file.  The style file would basically define variables, lay them out
>> in the appropriate order, and give instructions on surrounding 
>> punctuation.  Think BibTeX .bst files, but in XML.

There are two approaches that you could take.

The first option is to construct a stylesheet that does the
interpretation of your "style file" on-the-fly. You can access the
style file using the document() function and then use information from
it in just the same way as you would any other document. I usually end
up either applying templates to the document definition in the "style
file" itself, and either storing relevant information from the source
file as global variables or passing it around as parameters, or vice
versa (it depends if the "style file" or the source document should be
driving the overall structure of the output).

The second option is to transform the style file into an XSLT
stylesheet and then run the source document through that generated
stylesheet to get the output. Like this:

  style file  -- (XSLT) -->  stylesheet
                    source  -- (XSLT) -->  output

Either way, the stylesheets that you have to write can end up quite
hairy, but it means that changing the styles in the future just
involves changing the style file.



Jeni Tennison

Current Thread