Compartir a través de


p and s Elements

The p and s elements mark the paragraph and sentence structure of the document.

Syntax

<p xml:lang=”string”> </p>
<s xml:lang="string"> </s>

Attributes

Attribute

Description

xml:lang

Required. Specifies the language of the root document. The value may contain either a lower-case, two-letter language code, (such as en for English), or may optionally include an upper-case, country/region or other variation in addition to the language code, (such as zh-CN).

Remarks

Use of these elements is optional. The speech synthesis (TTS) engine automatically determines the structure of the document in the absence of these elements. A speech synthesis engine may produce changes in prosody when it encounters a p or s element.

For a given language code specified in the xml:lang attribute, a speech synthesis engine that supports that language code must be installed to correctly pronounce words in the specified language.

If the xml:lang attribute specifies only a language code, and not a country/region code, (such as xml:lang="en"), then any installed speech synthesis voice that expresses support for that generic, region-independent language may produce acceptable pronunciations for words in the specified language.

The p and s elements may declare different languages in their xml:lang attributes than the language declared in the xml:lang attribute of the speak element. The System.Speech.Synthesis namespace supports multiple languages in SSML documents.

Microsoft Windows and the System.Speech API accept all valid language-country codes, but only a limited number of text-to-speech (TTS) engines are provided with Windows 7. The TTS engines that are shipped with Windows 7 work with the following language codes.

  • en-US. English (United States)

  • zh-CN. Chinese (China)

  • zh-TW. Chinese (Taiwan)

Two-letter language codes such as "en" are also permitted.

Example

<?xml version="1.0" encoding="ISO-8859-1"?>
<speak version="1.0"
 xmlns="http://www.w3.org/2001/10/synthesis"
 xml:lang="en-US">

  <p>
    <s> Introducing the sentence element. </s>
    <s> It may be used to mark individual sentences. </s>
  </p>

  <p>
    Another simple paragraph.
    Sentence structure in this paragraph is not explicitly marked.
  </p>

</speak>