[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Fwd: i18n and l10n question
Hmm, maybe I should try to explain it better.
This is my XML-file: <factory> <parameter> <name></name> <type></type> <i18n> <properties> <entry key="parameter.caption">caption</entry> <entry key="parameter.description">description</entry> </properties> <node name="nl"> <properties> <entry key="parameter.caption">caption</entry> <entry key="parameter.description">description</entry> </properties> </node> </i18n> </parameter> <parameter> <name></name> <type></type> <i18n> <properties> <entry key="parameter.caption">caption</entry> <entry key="parameter.description">description</entry> </properties> <node name="nl"> <properties> <entry key="parameter.caption">caption</entry> <entry key="parameter.description">description</entry> </properties> </node> </i18n> </parameter> </factory> This should be transformed in a table that looks like: <table> <tr><td>caption</td><td>description</td></tr> ... </table> I use the following stylesheet: <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform"> <xsl:param name="locale"/> <xsl:variable name="locale2" select="substring-before ($locale,'_')"/> <xsl:key name="l" match="entry" use="concat(../../@name,' ',@key)"/> <xsl:key name="help" match="help" use="concat(../../@name,' ')"/> <xsl:template match="factory"> <table> <xsl:for-each select="parameter"> <tr> <td> <xsl:choose> <xsl:when test="key('l',concat($locale,' parameter.caption'))"> <xsl:apply-templates select="key('l',concat ($locale,' parameter.caption'))"/> </xsl:when> <xsl:when test="key('l',concat($locale2,' parameter.caption'))"> <xsl:apply-templates select="key('l',concat ($locale2,' parameter.caption'))"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="key('l',' parameter.caption')"/> </xsl:otherwise> </xsl:choose> </td> <td> <xsl:choose> <xsl:when test="key('l',concat($locale,' parameter.description'))"> <xsl:apply-templates select="key('l',concat ($locale,' parameter.description'))"/> </xsl:when> <xsl:when test="key('l',concat($locale2,' parameter.description'))"> <xsl:apply-templates select="key('l',concat ($locale2,' parameter.description'))"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="key('l',' parameter.description')"/> </xsl:otherwise> </xsl:choose> </td> </tr> </xsl:for-each> <table> </xsl:template> </xsl:transform> However, if there are two parameters, with caption n and r this returns: <table> <tr><td>nr</td><td>description 1description 2</td></tr> <tr><td>nr</td><td>description 1description 2</td></tr> </table> and not <table> <tr><td>n</td><td>description 1</td></tr> <tr><td>r</td><td>description 2</td></tr> </table> I would really appreciate any help on this. Thanks in advance, Nico Van Cleemput
|
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
|