Hi,
Looks like I'm stuck on a multiple languages issue again. I'm trying to
generate two different indexes, one for English and one for Japanese.
To set this up, I followed the instructions in *DocBook XSL: the Complete
Guide*.
I have <indexterm> elements in my document, like this:
<indexterm type="en"><primary>Hypothesis</primary></indexterm>
> <indexterm type="ja"><primary>仮説</primary></indexterm>
And <index> elements at the end, like this:
<index type="en"><title>Index</title></index>
> <index type="ja"><title>索引</title></index>
My customized style sheet includes:
<xsl:import href="docbook-xsl/fo/autoidx-kimber.xsl"/>
>
...
> <xsl:param name="autolink.index.see" select="0"/>
> <xsl:param name="index.on.type" select="1"/>
> <xsl:param name="index.method">kimber</xsl:param>
I try to run my book file through saxon like this:
$ java com.icl.saxon.StyleSheet \
> > -o tmp.fo \
> > book-1.xml \
> > custom-1.xsl
The CLASSPATH is set ike this:
CLASSPATH=/usr/local/lib/i18n_support/i18n_support.jar:/usr/local/Cellar/docbook-xsl/1.79.2_1/docbook-xsl/tools/lib/saxon.jar:
But it fails:
Error at xsl:variable on line 705 of file: custom-1.xsl:
> Key abbrev has not been defined
> Transformation failed: Run-time errors were reported
The offending line in the customization layer is in this template:
<xsl:template match="footnote" name="process.footnote"
> mode="process.footnote.mode">
It looks like this:
<xsl:variable name="lookup" select="key('*abbrev*', $biblioref)"/>
At this point, I'm kind of lost. I guess saxon is installed correctly, but
I'm not sure. The documentation for installing saxon on macOS mostly
assumes a level of expertise that I don't have.
In case it might help, my customization layer is here:
https://pastebin.com/raw/Qk8Es8ur
Any suggestions?
Thanks!
M.
On Wed, Dec 22, 2021 at 5:53 PM Eric Streit <[email protected]> wrote:
> pas de quoi .... sending in PM
>
> Eric
>
> Le 22/12/2021 à 08:53, M. Downing Roberts a écrit :
> > Hi,
> >
> > Thanks for your message. I followed your idea to install Noto Sans (from
> > Google fonts) and FOP on my machine can find the fonts now.
> >
> > <foreignphrase> works, but I'm still trying to figure out how to
> > customize the XSL so that <subtitle> uses a different font.
> >
> > If you don't mind sending your customization file, maybe I can learn
> > something by reading it.
> >
> > Merci mille fois !
> >
> > M.
> >
> > On Wed, Dec 22, 2021 at 4:24 PM Eric Streit <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> > re-
> >
> > and yes, sometimes, finding the name fof needs can be tricky. I used
> > some command line tools to find out what was the name fod wants: very
> > different from the name in the a folder for example.
> >
> > I don't remember which one I used at the time I was looking for it
> but
> > just try every "font manager" you can find, and you'll find it.
> >
> > I can send you my cutomization file if you want, I made some other
> > customization (for the list handling when the numbers are over 10
> > etc ...)
> >
> > Best regards
> >
> > Eric
> > Le 22/12/2021 à 08:15, M. Downing Roberts a écrit :
> > > Hi,
> > >
> > > Thanks very much for your suggestions. Using <foreignphrase> and
> the
> > > customization you suggested, the font is substituted. However,
> > although
> > > I specify Times or Arial, it tries Times-Roman or ArialMT,
> > neither of
> > > which include Japanese characters.
> > >
> > > Is there some way I can find out the names of the fonts that FOP
> > > believes I have installed? It seems like there's some mismatch
> > between
> > > what is shown in apps vs. what FOP thinks is actually available.
> > >
> > > Next, I was unable to get the <subtitle> element to substitute
> > the font.
> > > Here's the customization that I'm trying:
> > >
> > > <xsl:template match="subtitle"
> > mode="section.titlepage.recto.auto.mode">
> > > <xsl:choose>
> > > <xsl:when test="contains(' ja ', @xml:lang)">
> > > <fo:block
> > > xsl:use-attribute-sets="section.titlepage.recto.style"
> > > font-family="Times" font-weight="bold">
> > > <xsl:apply-templates select="."
> > > mode="section.titlepage.recto.mode"/>
> > > </fo:block>
> > > </xsl:when>
> > > <xsl:otherwise>
> > > <fo:block
> > > xsl:use-attribute-sets="section.titlepage.recto.style"
> > > font-family="{$title.fontset}">
> > > <xsl:apply-templates select="."
> > > mode="section.titlepage.recto.mode"/>
> > > </fo:block>
> > > </xsl:otherwise>
> > > </xsl:choose>
> > > </xsl:template>
> > >
> > >
> > > I must be doing something wrong, but I'm not sure what.
> > >
> > > Thanks,
> > >
> > > M.
> > >
> > > On Wed, Dec 22, 2021 at 3:35 PM Alemps Florimond
> > <[email protected] <mailto:[email protected]>
> > > <mailto:[email protected] <mailto:[email protected]>>>
> > wrote:
> > >
> > > Hello
> > >
> > > I would address this like that :
> > > <para>The Hōjōki [<foreignphrase xml:lang="ja">方丈記
> > > </foreignphrase>] is an important and popular short work of
> the
> > > early Kamakura period.</para>
> > >
> > > Customise font here :
> > > <xsl:template match="d:foreignphrase">
> > > <xsl:choose>
> > > <xsl:when test="contains(' ja ', @xml:lang)">
> > > <fo:inline font-family="Hiragino Mincho ProN">
> > > <xsl:apply-templates/>
> > > </fo:inline>
> > > </xsl:when>
> > > <xsl:otherwise>
> > > <xsl:call-template name="inline.italicseq"/>
> > > </xsl:otherwise>
> > > </xsl:choose>
> > > </xsl:template>
> > >
> > > "contains" is useful if you can use the same font for
> different
> > > languages ... :
> > > <xsl:when test="contains(' ja ko zh ', @xml:lang)">
> > > <fo:inline font-family= Hiragino Mincho ProN">
> > > <xsl:apply-templates/>
> > > </fo:inline>
> > > </xsl:when>
> > >
> > > For titles, I would condition attribute font-family in the
> > > appropriate xsl:attribute-sets="section.titlepage.recto.style
> > based
> > > on xml:lang as done above.
> > >
> > > To make sure it is not a problem with the font itself :
> > > 1. replace "Hiragino Mincho ProN" with Arial or Times or even
> > > 2. set attribute font-weight="bold"
> > >
> > > Hope this help
> > > Florimond
> > >
> > >
> > > Le mercredi 22 décembre 2021, 04:01:33 UTC+1, M. Downing
> Roberts
> > > <[email protected]
> > <mailto:[email protected]>
> > <mailto:[email protected]
> > <mailto:[email protected]>>>
> > > a écrit :
> > >
> > >
> > >
> > >
> > >
> > > I'm back with another question.
> > >
> > > I'd like to combine English and Japanese text in a single
> book. I
> > > can set the @lang attribute on various elements, but the
> > problem is
> > > that I need to switch fonts, too. The font that I want to use
> for
> > > body text doesn't include Japanese characters. I'm not sure
> > how to
> > > embed Japanese text within a <para> of English and get it to
> > render
> > > properly. E.g.:
> > >
> > > > <para>The Hōjōki [方丈記] is an important and popular
> > short work
> > > of the early Kamakura period.</para>
> > >
> > > It seems like I need something akin to <span lang="ja"> to
> > mark the
> > > Japanese text, and then a customization in the stylesheet to
> > detect
> > > this and specify a suitable font. However, I'm not sure how I
> > should
> > > handle either of these issues.
> > >
> > > I would also like to specify a different font for the
> <subtitle>
> > > element. I've tried this customization:
> > >
> > > > <xsl:template match="subtitle"
> > > mode="section.titlepage.recto.auto.mode">
> > > > <fo:block
> > xsl:use-attribute-sets="section.titlepage.recto.style"
> > > font-family="Hiragino Mincho ProN">
> > > > <xsl:apply-templates select="."
> > mode="section.titlepage.recto.mode"/>
> > > > </fo:block>
> > > > </xsl:template>
> > >
> > > > <xsl:template match="subtitle" mode="titlepage.mode">
> > > > <fo:block font-family="Hiragino Mincho ProN">
> > > > <xsl:apply-templates mode="titlepage.mode"/>
> > > > </fo:block>
> > > > </xsl:template>
> > >
> > > ...but it seems to have no effect. The font is not found,
> > though it
> > > is installed on my machine.
> > >
> > > What am I doing wrong? What's the best way to approach this?
> > >
> > > Thanks!
> > >
> > > M.
> > >
> > >
> >
>