Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] passing several external arguments to the spreadsheet

From: Martin Honnen <Martin.Honnen@---.-->
To: xsl-list@-----.------------.---
Date: 9/2/2009 2:22:00 PM
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/

--~------------------------------------------------------------------
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@l...>
--~--



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent