Subject: Re: [xsl] global language parameter From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 14 Feb 2010 07:57:41 -0500 |
Ken's response, together with this, exposes the fact that I don't really know what I am doing here.
My understanding of the notion of "global parameter" was that of a style that could be applied to any content element (in, for example, Chinese) throughout my XML document, regardless of whether it was <p xml:lang="zh">, <item xml:lang="zh">, <term xml:lang="zh">, <ref xml:lang="zh">, etc.
In other words, I could just write the style declaration for this once at the top of my style sheet, and not have to write it separately at each element.
Perhaps I am using the wrong terminology?
Or attempting something that can't be done?
<xsl:template match="*[@xml:lang]" priority="1"> <xsl:choose> <xsl:when test="lang('sa')"> <span style="font-family: 'Times Ext Roman'"> <xsl:next-match/> </span> </xsl:when> <xsl:when test="lang('zh')"> <span style="font-family: Mincho,MingLiU, Batang, Simsun"> <xsl:next-match/> </span> </xsl:when> <xsl:when test="lang('ko')"> <span style="font-family: Batang, BatangChe"> <xsl:next-match/> </span> </xsl:when> <xsl:otherwise> <xsl:next-match/> </xsl:otherwise> </xsl:choose> </xsl:template>
<xsl:stylesheet ...> <xsl:import href="main-stylesheet"/>
<xsl:template match="*[@xml:lang]"> <xsl:choose> <xsl:when test="lang('sa')"> <span style="font-family: 'Times Ext Roman'"> <xsl:apply-imports/> </span> </xsl:when> <xsl:when test="lang('zh')"> <span style="font-family: Mincho,MingLiU, Batang, Simsun"> <xsl:apply-imports/> </span> </xsl:when> <xsl:when test="lang('ko')"> <span style="font-family: Batang, BatangChe"> <xsl:apply-imports/> </span> </xsl:when> <xsl:otherwise> <xsl:apply-imports/> </xsl:otherwise> </xsl:choose> </xsl:template>
-- XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19 XSLT/XQuery/XPath training: San Carlos, California 2010-04-26/30 Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] global language parameter, Syd Bauman | Thread | [xsl] Can I predict the build order, Kevin Brown |
Re: [xsl] Re: Testing the existence, Stefan Krause | Date | Re: [xsl] Re: Testing the existence, Imsieke, Gerrit, le- |
Month |