[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] passing several external arguments to the spreadsheet


Subject: [xsl] passing several external arguments to the spreadsheet
From: Manuel Souto Pico <manuel.souto@xxxxxxxxxxxxxx>
Date: Wed, 02 Sep 2009 16:10:25 +0200

Dear xslters,

I would like to know whether it's possible to do the following with XSLT.

I've got one XML file with one <file> element and I would like to transform it into a XML file which has several <file> elements, the only different among them being a lang attribute (the content of <file> should be the same in the input and the output). Let me show you some code and you'll see more clearly:

___intput___:
<xliff>
   <file>(...)</file>
</xliff>

___desired output___:
<xliff>
   <file lang="en">(...)</file>
   <file lang="fr">(...)</file>
   <file lang="pt">(...)</file>
</xliff>

Is it possible to pass the respective values of that attribute to the spreadsheet in some way, so that the spreadsheet will know how many (depending on the number of values) <input> elements must be generated and what value exactly their lang attribute must have. I'm wondering about how to pass the arguments to the spreadsheets and how the spreadsheets should handle them.

If this was a perl script, I would run:

$ perl -lang=en,fr,pt script.pl input.xml > output.xml

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'd be grateful for any opinion.

Best regards!!

--
Manuel Souto Pico
Terminrleg / Responsable de servei thcnic
manuel.souto@xxxxxxxxxxxxxx <mailto:manuel.souto@xxxxxxxxxxxxxx>

*STAR Servicios Ling|msticos*
C. Sardenya, 195-197 (baixos)
E-08013 Barcelona
Tel. +34 932 440 889
Fax: +34 932 471 273
http://www.star-spain.com
http://www.star-group.net <http://www.star-spain.com>

En cumplimiento con lo previsto en los artmculos 21 y 22 de la Ley 34/2002, de 11 de julio, de Servicios de la Sociedad de Informacisn y Comercio Electrsnico (LSSI) y las disposiciones de la Ley Organica 15/1999, de 13 de diciembre de Proteccisn de Datos de Caracter Personal (LOPD) le informamos que procederemos al archivo y tratamiento de sus datos exclusivamente con fines de promocisn de los productos y servicios ofrecidos por STAR Servicios Ling|msticos, S.L. Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener informacisn confidencial o legalmente protegida, siendo para uso exclusivo del destinatario. No hay renuncia a la confidencialidad o secreto profesional por cualquier transmisisn defectuosa o errsnea, y queda expresamente prohibida su divulgacisn, copia o distribucisn a terceros sin la autorizacisn expresa de STAR Servicios Ling|msticos, S.L. Si ha recibido este mensaje por error, se ruega lo notifique a STAR Servicios Ling|msticos enviando un mensaje al remitente o al correo electrsnico info@xxxxxxxxxxxxxx y proceda inmediatamente al borrado del mensaje original y de todas sus copias. Gracias por su colaboracisn. Si desea mas informacisn sobre sus derechos en lo que respecta al tratamiento de sus datos de caracter personal, visite http://www.star-spain.com/es/inicio/lopd.php


Current Thread
Keywords
xml