At 2010-02-14 10:18 +0900, Charles Muller wrote:
Ken's response, together with this, exposes the fact that I don't
really know what I am doing here.
Not a problem ... at the least you were trying your own solution
rather than simply asking for your issue to be solved without trying
(as some posters do).
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.
Then I wouldn't call that a "global parameter" since it is changing
as it is applied to each construct.
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.
I believe you want to write the style processing for this once and
have it engaged by every element.
Perhaps I am using the wrong terminology?
That is a start ... you want some global code to be executed for each
element so as to wrap its processing in a span.
Or attempting something that can't be done?
We won't be sure until we understand exactly what you are trying to
do. But if I've guessed correctly, there is some "global processing"
you can do on each and every element that is characterized (or not)
as you need.
If you are using XSLT 2.0, then you could add this to inject
processing before the processing of every element that has an
xml:lang= attribute:
<xsl:template match="*[(_at_)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>
If you are using XSLT 1.0, then you get this behaviour using an
onion-skin-thin importing stylesheet:
<xsl:stylesheet ...>
<xsl:import href="main-stylesheet"/>
<xsl:template match="*[(_at_)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>
</xsl:stylesheet>
In both cases above the template rule intercepts all elements that
have xml:lang=, does the processing, and then lets the "regular"
processing then continue inside of the span.
I hope this is helpful.
. . . . . . . . . . . . . . Ken
--
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(_at_)CraneSoftwrights(_dot_)com
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--