[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Translating grammars XML in others languages
Hi Paolo, I had a small glimpse on your code and the last template you are trying to use will not work because you may not apply templates to a node-set inside a variable. Why don't you apply the stylesheet you have defined directly to the document and passing additional information, such as the language to which the document is to be translated to the stylesheet? You would then be able to use <xsl:template match="/"> word - Need to be a qname--> <xsl:apply-templates/> </xsl:template> =). You must re-define your system for the translation to use either, multiple stylesheets and transformations or use the documents holding the information on translation simply as a lookup table, i.e. a document which contains all the element and attribute names in the original language and the corresponding names in the target language: <translation lang="Spanish"> <element name="DADOS-GERAIS" translation="WHATEVER_THIS_MEANS"/> <attribute name="DATA-ATUALIZACAO" translation="CHANGED"/> </translation> You then may reference this document, using <xsl:variable name="vTranslation" select="document(concat("translations", $Global_Language_Parm, ....))"/> now, you write a generic translation stylesheet which takes an arbitrary language source document, having only three or four basic templates one for the document root one for element nodes one for attribute nodes one template to match 'em all =) <xsl:template match="/"> word - Need to be a qname--> <xsl:apply-templates/> </xsl:template> <xsl:template match="node()"> word - Need to be a qname--> <xsl:apply-templates/> </xsl:template> <xsl:template match="@*"> word - Need to be a qname--> <xsl:attribute name="$vTranslation/... <!-- find node which matches the local-name of the current attribute node in the translation document and get the value of the translated attribute name from it ... --> <xsl:apply-templates/> </xsl:template> <xsl:template match="*"> <!-- other nodes (CDATA/Comment...) --> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> Hope this gives you an idea of how to make this translation of yours more generic and universal. Bye Carsten XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|