vipasane 0 Posted July 8, 2011 Report Share Posted July 8, 2011 Hi,I have an XSLT which uses common phrases to implement multilingual support. I would like to have a another xslt which could easily show up which phrases are used and where they are usedExample of usage: <!-- usage in xslt --><xsl:value-of select="$phrases/Value[@name='HEADER_title']/child::*[name() = $languageCode]"/><!-- replacements -->"<xsl:value-of select="$phrases/Value[@name='" should be replace as "Phrase:""']/child::*[name() = $languageCode]"/>" and respectively should replace as empty string How can I implement this with xsl version 1.0?I'm thankful for any help or thoughts you might bring in to this topic Quote Link to post Share on other sites
Martin Honnen 16 Posted July 8, 2011 Report Share Posted July 8, 2011 (edited) Sorry, I don't understand what you want to achieve. Processing XSLT with XSLT is possible as XSLT is XML but other than that I don't understand what you want to achieve so far. You might want to show a sample of the XSLT you have and the corresponding output you want to create. Edited July 8, 2011 by Martin Honnen Quote Link to post Share on other sites
vipasane 0 Posted July 8, 2011 Author Report Share Posted July 8, 2011 Ok I'll try my best, this is simplified version of xslt I have: <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes" doctype-public="-//W3C/DTD XHTML 1.0Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" standalone="yes" media-type="text/html"/> <xsl:variable name="phrases" select="document('invoice_phrases.xml')/phrases"/> <xsl:template match="Invoices"><xsl:variable name="languageCode" select="Header/LangCode"/> <html> <head> <title/> <link rel="stylesheet" type="text/css" href="invoice_styles.css" title="Style"/> </head> <body> <h1><xsl:value-of select="$phrases/Value[@name='HEADER_title']/child::*[name() = $languageCode]"/> </h1> </body> </html> </xsl:template> And this is from invoice_phrases.xml: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><phrases xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Value name="HEADER_title"> <DE>Invoice in germany</DE> <EN>Invoice</EN> </Value></phrases> In order to find out which phrases are used and where in the initial xslt, I would like to make another xslt which will automatically "document" it by using the same layout but replaces "<xsl:value-of select="$phrases/Value[@name=" with string "Phrase variable:"and rest of it "]/child::*[name() = $languageCode]"/>" with empty string. At the end I would have the same html layout, but phrases are replaced with variable names instead of valid translations like in example: the html output is replaced as follows depending on a language code value of "HEADER_title" in phrases.xml is replaced with PHRASE: HEADER_titleI know it's a mess when I try to explain something, it only gets from bad to worse Quote Link to post Share on other sites
vipasane 0 Posted July 11, 2011 Author Report Share Posted July 11, 2011 Sure I could do it statically (eg. every time these things needs some validation) with a by editing current XSLT file using Find & Replace, but I when I'm not around there should some automation so that not-technical person could do it too. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.