On Mar 21, 2004, at 3:42 PM, Dave Roe wrote:


Hi Simon,

On Mar 19, 2004, at 8:17 PM, S. Woodside wrote:

You can generate XSL using the exsl document output function, then run the generated XSL on a document using the regular XSL document() function.

If you need more info I can provide it.

Yes, please. <snip>

I'm talking about the creation of dynamic XSL. In other words, code-generation, and then executing the generated code. EXSLT provides a document function, which is supported by LibXSLT. (you don't need to download anything from exslt.org) You activate it in your XSL with something like this


  xmlns:exsl="http://exslt.org/common";
  extension-element-prefixes="exsl"

in the xsl:stylesheet element. Then <exsl:document ... > will create xml output into a separate document file. You also create a dummy "genxsl" (or whatever) prefix,

xmlns:genxsl="foobarfoo"

Then you need a namespace alias:

<xsl:namespace-alias stylesheet-prefix="genxsl" result-prefix="xsl"/>

This will convert anything that's prefixed genxsl: in your stylesheet, into xsl: in the output. Then do something like this:

    <exsl:document href="gen.xsl" indent="yes" encoding="UTF-8" >
      <genxsl:stylesheet version="1.0">
...

and insert your code there. Any xslt prefixed with genxsl will execute when you run the generated code, anything prefixed with xsl will run now. You can mix and match.

To run the generated code, just fire off an axkit: URI document request:

<xsl:copy-of select="document('axkit:/foo/bar.xml')"/>

Use the usual axkit methods to specify that bar.xml will go through gen.xsl

simon

--
99% Devil, 1% Angel
homepage http://www.simonwoodside.com
for the developing world http://www.openict.net


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to