[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: passing several external arguments to the spreadsh

Subject: Re: passing several external arguments to the spreadsheet
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Wed, 02 Sep 2009 16:21:20 +0200
Re:  passing several external arguments to the spreadsh
Manuel Souto Pico wrote:

Is it possible to run something like that using the param option (or, even better, to do it in the editor)? (in capitals for clarity)

$ java -jar path/to/saxon9.jar LANG=en,fr,pt input.xml spreadsheet.xsl > output.xml

I guess it must be something like that, but then, how do I get those 3 or n parameters into the spreadsheet? If it was only one parameter i would get it with

<xsl:param name="lang"/>

but as there are more than one, I guess I should put them in a kind of array and then do a for-each?

I think you should be able to pass in a string value as the parameter and then use the tokenize function to split it up into a sequence of lang values e.g.
<xsl:param name="lang"/>
<xsl:variable name="languages" select="tokenize($lang, ',')"/>


  <xsl:template match="xliff">
    <xsl:copy>
      <xsl:variable name="file" select="file"/>
      <xsl:for-each select="$languages">
        <xsl:apply-templates select="$file">
          <xsl:with-param name="lang" select="."/>
        </xsl:apply-templates>
      </xsl:for-each>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="file">
    <xsl:param name="lang"/>
    <xsl:copy>
      <xsl:attribute name="lang" select="$lang"/>
      <xsl:copy-of select="node()"/>
    </xsl:copy>
  </xsl:template>



--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.