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

Re: [xsl] global language parameter


Subject: Re: [xsl] global language parameter
From: Charles Muller <cmuller-lst@xxxxxxxxxxxxxxx>
Date: Mon, 15 Feb 2010 18:02:41 +0900

G. Ken Holman wrote:

Then perhaps you should try and take a piecemeal approach for maintenance purposes.

Once again, much thanks for the detailed explanation. I have built the following and tested it successfully. I can now move to the rest of the components of the sheet.


Chuck


<xsl:template name="add-style">
<xsl:attribute name="style">
<!--what is the margin component-->
<xsl:choose>
<xsl:when test="@rend='indent'">
<xsl:text>text-indent:12mm; margin-top: 0;margin-bottom: 0; </xsl:text>
<xsl:text>line-height:9mm;</xsl:text>
</xsl:when>
<xsl:when test="@rend='plain'">
<xsl:text>text-indent:0;margin-left:0; margin-top:0;</xsl:text>
<xsl:text>margin-bottom: 0; line-height:9mm;</xsl:text>
</xsl:when>
<xsl:when test="@rend='blockquote'">
<xsl:text>text-indent:0;margin-left:12mm; margin-top:1em;</xsl:text>
<xsl:text>margin-bottom: 1em; margin-right: 2em;</xsl:text>
<xsl:text>line-height:9mm;</xsl:text>
</xsl:when>
<xsl:when test="@rend='blockquoteNested1'">
<xsl:text>margin-left:15mm; margin-top:0.5em; </xsl:text>
<xsl:text> text-indent:0mm; margin-right:2mm;</xsl:text>
<xsl:text>margin-bottom:0.5em;line-height:7mm;</xsl:text>
</xsl:when>
<xsl:when test="@rend='verseline'">
<xsl:text>margin-left:12mm; margin-top:0em;</xsl:text>
<xsl:text>margin-bottom:0em;</xsl:text>
<xsl:text> text-indent:0mm; margin-right:12mm ; </xsl:text>
<xsl:text>line-height:7mm;</xsl:text>
</xsl:when>
<xsl:when test="@rend='passage'">
<xsl:text>margin-left:5%; margin-right:5%; margin-top:0.7em;</xsl:text>
<xsl:text> text-indent:0mm; line-height:8mm;</xsl:text>
<xsl:text>margin-bottom:0.7em;</xsl:text>
</xsl:when>
<xsl:when test="@rend='centered'">
<xsl:text>text-align: center; margin-top: 0; margin-bottom: 0;</xsl:text>
<xsl:text>line-height:7mm;</xsl:text>
</xsl:when>
<xsl:when test="@rend='note'">
<xsl:text>font-size:90%; margin-left:0; margin-top:1em;</xsl:text>
<xsl:text>line-height:6mm; margin-bottom:0; text-indent:0mm;</xsl:text>
</xsl:when>
<xsl:when test="@rend='hangInd'">
<xsl:text>text-indent:-10mm;margin-left:10mm;</xsl:text>
</xsl:when>
<xsl:when test="@rend='indHangInd'">
<xsl:text>text-indent:-10mm;margin-left:15mm;</xsl:text>
</xsl:when>
<xsl:when test="@rend='plainTight'">
<xsl:text>margin-left:5%; margin-top:0; margin-bottom:0;</xsl:text>
<xsl:text> text-indent:0mm; line-height:6mm;</xsl:text>
</xsl:when>
<xsl:when test="@rend='abstract'">
<xsl:text>font-size:80%; line-height:5mm; margin-bottom:0;</xsl:text>
<xsl:text>margin-top:0;</xsl:text>
<xsl:text> margin-left:10%; margin-right:10%;</xsl:text>
</xsl:when>
</xsl:choose>


<!--what is the language component-->
<xsl:choose>
<xsl:when test="lang('sa')">font-family: 'Times Ext Roman', Times New Roman;</xsl:when>
<xsl:when test="lang('zh')">font-family:MingLiU, Mincho,Batang, Simsun;</xsl:when>
<xsl:when test="lang('ko')">font-family: Batang, BatangChe;</xsl:when>
<xsl:when test="lang('ja')">font-family: 'o<-o<3 o<0ff', Mincho;</xsl:when>
<xsl:otherwise>font-family: 'Times Ext Roman', Times New Roman;</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>


<xsl:template match="p">
<xsl:choose>
<xsl:when test="@rend='showhide'">
<xsl:variable name="cjknum" select="count(preceding::p[@rend='showhide'])+1"/>
<xsl:variable name="togglelabel" select="concat('chin','-',$cjknum)"/>
<span onclick="toggle('{$togglelabel}');return false;" style="font-size:90%">[<a href="#"
><xsl:value-of select="$cjksource"/></a>]</span>
<div id="{$togglelabel}" style="display: none">
<p style="font-family: Mincho,MingLiU, Simsun; font-size:110%; margin-right:5em">
<xsl:apply-templates/>
</p>
</div>
</xsl:when>


<xsl:when test="@rend='showhide-bibl'">
<xsl:variable name="recordnum" select="count(preceding::p[@rend='showhide-bibl'])+1"/>
<xsl:variable name="togglelabel" select="concat('chin','-',$recordnum)"/>
<span onclick="toggle('{$togglelabel}');return false;" style="font-size:100%">[<a href="#"
><xsl:value-of select="$works"/></a>]</span>
<div id="{$togglelabel}" style="display: none">
<p style="font-size:100%; margin-right:5em">
<xsl:apply-templates/>
</p>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<xsl:call-template name="add-style"/>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>



-- -------------------

A. Charles Muller

University of Tokyo
Graduate School of Humanities and Sociology, Faculty of Letters
Center for Evolving Humanities
Akamon kenkyE+ tE
#722
7-3-1 HongE
, BunkyE
-ku
Tokyo 113-0033, Japan

Web Site: Resources for East Asian Language and Thought
http://www.acmuller.net

<acmuller[at]jj.em-net.ne.jp>

Mobile Phone: 090-9310-1787


Current Thread