The first step is to include an entry for the PLS file in the EPUB manifest:
<item href="lexicon.pls" id="pls" media-type="application/pls+xml"/>
The href attribute defines the location of the file
relative to the package document and the media-type attribute value “application/pls+xml” identifies to a
reading system that we’ve attached a PLS file.
Including one or more PLS files does not mean they apply by default to all your
content, however; in fact, they apply to none of it by default. You next have to
explicitly tie each PLS lexicon to each XHTML content document it is to be used
with by adding a link element to the document’s
header:
<html …>
<head>
…
<link
rel="pronunciation"
href="lexicon.pls"
type="application/pls+xml"
hreflang="en" />
…
</head>
…
</html>
There are a number of differences between the declaration for the PLS file in the
publication manifest above and in the content file here. The first is the use of
the rel attribute to include an explicit
relationship (that the referenced file represents pronunciation information).
This attribute represents somewhat redundant information, however, since the
media type is once again specified (here in the type attribute). But as it is a required attribute in HTML5, it
can’t be omitted.
The HTML link element also includes an additional
piece of information to allow selective targeting of lexicons: the hreflang attribute. This attribute specifies the
language to which the included pronunciations apply. For example, if you have an
English document (as defined in the xml:lang
attribute on the html root element) that embeds
French prose, you could include two lexicon files:
<link
rel="pronunciation"
href="lexicon/en.pls"
type="application/pls+xml"
hreflang="en" />
<link
rel="pronunciation"
href="lexicon/fr.pls"
type="application/pls+xml"
hreflang="fr" />
Assuming all your French passages have xml:lang
attributes on them, the reading system can selectively apply the lexicons to
prevent any possible pronunciation confusion:
<p>It's the Hunchback of <i xml:lang="fr">Notre Dame</i> not of Notre Dame.</p>
A unilingual person reading this prose probably would not understand the distinction being made here: that the French pronunciation is not the same as the Americanization. Including separate lexicons by language, however, would ensure that readers would hear the Indiana university name differently than the French cathedral if they turn on TTS:
<lexicon
version="1.0"
alphabet="x-sampa"
xml:lang="en"
xmlns="http://www.w3.org/2005/01/pronunciation-lexicon">
<lexeme>
<grapheme>Notre Dame</grapheme>
<phoneme>noUt@r 'deIm</phoneme>
</lexeme>
</lexicon>
<lexicon
version="1.0"
alphabet="x-sampa"
xml:lang="fr"
xmlns="http://www.w3.org/2005/01/pronunciation-lexicon">
<lexeme>
<grapheme>Notre Dame</grapheme>
<phoneme>n%oUtr@ d"Am</phoneme>
</lexeme>
</lexicon>
When the contents of the i tag are encountered, and
identified as French, the pronunciation from the corresponding lexicon gets
applied instead of the one from the default English lexicon.