Firstly, I would not retrieve the "input.xml" every time, store it in a variable. Although I suspect that Mr. Kay's programming skills are such that Saxon caches requests for external documents it seems good practice not to rely on it.
Secondly add an xsl:param element which you pass the name of the module. You can then use a second variable to filter the input.xml
Code:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="moduleName" />
<xsl:variable name="input" select="document('input.xml')" />
<xsl:variable name="module" select="$input/subbuild/module[@name = $moduleName]" />
Another improvement might be to also pass the name of the secondary file:
Code:
<xsl:param name="inputDoc"/>
<xsl:variable name="input" select="document($inputDoc)" />
You can then pass in the params at the command line:
Code:
java -jar saxon8.jar source.xml style.xsl moduleName=communicator [inputDoc=input.xml]
--
Joe (
Microsoft MVP - XML)