Re: [xsl] global language parameter

Subject: Re: [xsl] global language parameter
From: Charles Muller <cmuller-lst@xxxxxxxxxxxxxxx>
Date: Mon, 15 Feb 2010 16:36:23 +0900
G. Ken Holman wrote:

And when you then find after distilling all of this out that you are always building your style attribute the same way based on added attributes, you can localize the entire processing along the lines of:

  <xsl:template match="p">
      <xsl:call-template name="add-style"/>

  <xsl:template match="another">
      <xsl:call-template name="add-style"/>

  <xsl:template name="add-style">
    <xsl:attribute name="style">
      <!--what is the margin component-->
        <xsl:when test="@render='this'">
          <xsl:text>text-indent:12mm; margin-top: 0;</xsl:text>
          <xsl:text>margin-bottom: 0; line-height:9mm;</xsl:text>
        <xsl:when test="@render='that'">
          <xsl:text>text-indent:30mm; margin-top: 5mm;</xsl:text>
          <xsl:text>margin-bottom: 0; line-height:12mm;</xsl:text>

<!--what is the language component-->
<xsl:when test="lang('sa')">font-family: 'Times Ext Roman';</xsl:when>
<xsl:when test="lang('zh')"
>font-family: Mincho,MingLiU, Batang, Simsun;</xsl:when>
<xsl:when test="lang('ko')">font-family: Batang, BatangChe;</xsl:when>


Thank you for taking the time to do this. My style sheets are now all going to be transformed to a new level.




A. Charles Muller

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

Web Site: Resources for East Asian Language and Thought


Mobile Phone: 090-9310-1787

Current Thread