Charles,
Pardon me if I'm doing you wrong. I think that you are trying to
create and use a named template with a parameter, to be called from
elsewhere, where you have determined that an element has an @xml:lang
attribute. This is needlessly complicated.
A straightforward match of all elements with @xml:lang and insertion
of the <span> around the matching element would be sufficient.
If this is NOT what you intend, please follow the suggestions of
others, and POST MORE INFO!
<xsl:template match="element()[(_at_)xml:lang]">
<xsl:choose>
<xsl:when test="@xml:lang='de'">
<span style="font-family: 'URW Gothic L'">
<xsl:copy-of select="."/>
</span>
</xsl:when>
<xsl:when test="@xml:lang='en'">
<span style="font-family: serif">
<xsl:copy-of select="."/>
</span>
</xsl:when>
<xsl:when test="@xml:lang='ko'">
<span style="font-family: Batang, BatangChe">
<xsl:copy-of select="."/>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*|@*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
-W
On Sun, Feb 14, 2010 at 2:18 AM, Charles Muller
<cmuller-lst(_at_)jj(_dot_)em-net(_dot_)ne(_dot_)jp> wrote:
Martin Honnen wrote:
I'm taking my first stab at making a global parameter, through which I'd
like to set font attributes for character sets of different languages. I'm
using TEI-P5 with XSL 2, and I want my parameter to work with xml:lang.
It tried writing this way:
<xsl:template name="languageWrap">
<xsl:param name="contents">
<xsl:apply-templates/>
</xsl:param>
I am not sure I understand what you want to achieve without seeing the input
XML and the output you want to create but your text above says "making a
global" parameter while here you are defining a parameter that is local to
your template named "languageWrap".
A global parameter is defined as a child of the xsl:stylesheet element, not
inside of a template, and is used to allow to pass in a value to the
transformation that can be changed each time the transformation is run.
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?
Regards,
Chuck
-------------------
A. Charles Muller
University of Tokyo
Graduate School of Humanities and Sociology, Faculty of Letters
Center for Evolving Humanities
Akamon kenkyū tō #722
7-3-1 Hongō, Bunkyō-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
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--