[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: global language parameter

Subject: Re: global language parameter
From: Charles Muller <cmuller-lst@xxxxxxxxxxxxxxx>
Date: Mon, 15 Feb 2010 16:36:23 +0900
Re:  global language parameter
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">
    <p>
      <xsl:call-template name="add-style"/>
    </p>
  </xsl:template>

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

  <xsl:template name="add-style">
    <xsl:attribute name="style">
      <!--what is the margin component-->
      <xsl:choose>
        <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>
        <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>
        </xsl:when>
      </xsl:choose>

<!--what is the language component-->
<xsl:choose>
<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>
</xsl:choose>
</xsl:attribute>
</xsl:template>

Excellent!


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

Regards,

Chuck

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

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.