XSL Testing multiple nodes
Like a kid with a new toy.
I'd like to credit the author but can't find the reference any more. This is a nice readable solution to testing against multiple nodes.
<xsl:variable name="testresult">
<xsl:for-each select="element/attribute">
<xsl:if test="test1">x</xsl:if>
<xsl:if test="test2">x</xsl:if>
<xsl:if test="test3">x</xsl:if>
<xsl:if test="test4">x</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="string-length($testresult)!=0">
Do something.....
</xsl:if>
Labels: xslt
Batch Processing DITA Files
I was looking for a flexible way to deliver an unspecified number of variations for the same help material. I didn't relish maintaining that many project files or trying to figure out how to run them. It was an interesting challenge. Someone asked about using variables in the ant files on the dita list, but that wouldn't have worked for me anyway.
I resorted to batch files and ant's overrides. The ditamaps were, of course, generated. :-)
Check out:
Apache Ant Demystified - parts 1 and 2
Here's an example:
______Batch_____
:: @echo off
:: Copyright 2007 Judy Newell
:: 1. identify the directory where the ditamap files are (input).
:: 2. identify the location of the ant file (antloc).
::
:: ant -f empathica_xhtml -Dargs.input=ditamap -Doutput.dir=output/client
:: If directories are not specified in the command line, use the test directories
SET input=c:\ditamaps
SET antloc=c:\project\ant
:: set commandline input and antloc parameters in variables
IF NOT (%1)==() SET input=%1
IF NOT (%2)==() SET antloc=%2
set old=%cd%
cd %antloc%
FOR %%I IN (%input%\*.ditamap) DO ant -f project_xhtml.xml -Dargs.input="%%I" -Dargs.xhtml.toc=%%~nI_index
cd %old%
:eof
_____Batch_____
More overrides...
FOR %%F IN (%input%\*.ditamap) DO ant -f project_index.xml -Dargs.input="%%F" -Doutput.dir=output\%%~nF\ -Doutput.file=%%~nF_indextermlist.html
Regards,
Judy
Labels: ant, batch, dita
Gotta love the internet.
Jack Herrington's short article about batch processing xml files with xslt2.0 relies on having a file that lists the xml files to be processed. HXDLG builds and xml file of the files found in a specified directory.
I have not tested this yet, that's tomorrow. But damn it looks promising.
Read the
article to get all the info.
Labels: batch, xslt
George Lange, Photographer
Third frivolous post. But really, it is worth the time.
Slideshow of photographer's favourites from 2006.Labels: photo, wow
American vs. Canadian Spelling
Nice read on the American/Canadian spelling issue in the Language Log:
Foolish HobgoblinsLabels: editing, writing
XML/XSL Tools
New Favourite ToolIf you have to write and therefore debug xslt stylesheets, you really need to take a good look at the oXygen editor. It does all the things you expect an editor to do:
- handling multiple file formats in addition to xml/xsl
- context-appropriate word completion
- multi-platform support
- etc., etc.
oXygen does one more thing that really makes it worth the money. It allows you to step through the style sheet processing side by side with the xml input, highlighting both the current template instruction and the xml bit being processed.
For a 30-day trial, checkout the oXygen download page.
All-in-one tool for free:
I recently took a look at
Mircosoft's Visual Web Developer - Express Edition. Microsoft's
tagline for the Express Edition products is: "Free, lightweight, easy-to-use, and easy-to-learn tools for the hobbyist, novice, and student developer".
The editor provides validation and ease of use tools for web related docs:
One of the benefits of
working with a tool like this is being able to work with the different types of files in a consistent environment. I even used it to create a
dita doc project:
dita files, ant files,
xsl files, and
css.The price is right; it's worth taking a look at it. Click the link below.
Express - Visual Web Developer
Labels: oxygen, visual web developer, xml, xslt