xsl-list
[Top] [All Lists]

More than one parameter for stylesheet

2005-07-21 09:14:56
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[(_at_)categoryid='CAT1']"/> 
    </bookshelf>
  </xsl:template>        

  <xsl:template match="category[(_at_)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 f�r Mail, Message, More +++

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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