[xsl] More than one parameter for stylesheet

Subject: [xsl] More than one parameter for stylesheet
From: "Karl Koch" <TheRanger@xxxxxxx>
Date: Thu, 21 Jul 2005 18:14:56 +0200 (MEST)
Hello,

I have XML about 10000 books in 39 categories. I have 39 stylesheets and
each extracts exactly books for one of those categories. I did this solution
some time ago and it worked. However, now I need to make some modification
in that script and, as you can imagine, it needs to be done in all 39
scripts. That is very boring and I don't like repetitive work. Also, in case
the scrpt changes again, I will need to do it again for 39 times and so
on... I guess you see the problem by now... 

The stylesheet is here:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:template match="/">
    <bookshelf>
      <xsl:apply-templates select="//category[@categoryid='CAT1']"/> 
    </bookshelf>
  </xsl:template>        

  <xsl:template match="category[@categoryid='FTUKSDIV3']">
    <xsl:copy-of select="../../*"/>                
  </xsl:template>    
</xsl:stylesheet>
 
Currently I execute the script with the following command line (in total 39
runs with 39 scripts):

java org.apache.xalan.xslt.Process -IN ..\10000books.xml -XSL
extractByCategory_CAT1.xslt >CAT1.xml

Looking at that, you can see that I use the input XML file in the command
line. I don't want to change that since I want to keep the flexibility to
apply the script to different XML files, if necessary. Now, I am wondering
if I can also put the category id (which is currently hardcoded in each of
the 39 stylesheets) as a parameter as well and feed that in via commandline.
Is this possible? If yes, how?

How would the command line look like? Something like that... (?)

java org.apache.xalan.xslt.Process -IN ..\10000books.xml CAT1 -XSL
extractByCategory.xslt >CAT1.xml

I immagine the result in a way that I would only need to change ONE
stylesheet and the batch file in case of another change.

Kind Regards,
Karl



-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse fo?=r Mail, Message, More +++

Current Thread