xsl-list
[Top] [All Lists]

Re: union vs. "or" vs. contains?

2004-10-20 16:23:13
Wendell Piez wrote:
At 12:05 PM 10/20/2004, Rob wrote:

Wendell Piez wrote:

Whatever I do, I want to keep processing completely controlled by the configuration file.


Maybe someone on this list who knows Ant better than I do (it's on my list!) can comment on how Ant (a Java build framework) could query a configuration file to determine which stylesheet to call when a job is invoked. A poor man's version of the same (though of course Ant is free) could use a batch file to run a transform on your config file, to create another batch file (in which the delegation could be managed), and then execute it. In other words, these things can be done.



I haven't followed this thread too closely but in ant you can use 'input' to allow the user to enter data at the command line. For example:

<input
  message="Enter an XSL file name:"
  addproperty="xsl.name"/>

<xslt
  in="source.xml"
  out="result.html"
  style="${xsl.name}"/>


Ah, that's nice.

I presume it also wouldn't be hard to get a value for xsl.name by querying into an XML config document?


Sure. You can use the XmlProperty task to load properties from a well formed props-like file:

<root>
  <properties>
    <foo>bar.xsl</foo>
  </properties>
</root>

which is roughly equivalent to this Java property file:

root.properties.foo = bar.xsl

or
<xslt
  in="source.xml"
  out="result.html"
  style="${root.properties.foo}"/>



Of course, you could also load the config into the transformation to find the XSL template name to call.

Or you could transform the config file to an ant build file. You can also use/create an XMLCatalog for custom resolution. You can also use a validate task to ensure your content is valid according to some schema.

Ant is wonderful :)


or simply doing some kind of conditional testing to provide for a mapping of labels to stylesheets,

This gets tricky in ant, but can be done using javascript or some scripting language that can be brought into ant (but it is kind of like using extensions in XSL).

or simply

<input
  message="Which format would you like?"
  addproperty="format"/>

<xslt
  in="source.xml"
  out="result.html"
  style="${format}.xsl"/>

sure -- much more user friendly :)

best,
-Rob


Cheers,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


<Prev in Thread] Current Thread [Next in Thread>