HTML4.01規範-HTML文檔的頂層結構(2)

META 元素

<!ELEMENT META - O EMPTY               -- generic metainformation --> 
<!ATTLIST META 
  %i18n;                               -- lang, dir, for use with content --   
http-equiv  NAME           #IMPLIED  -- HTTP response header name  --
 name        NAME           #IMPLIED  -- metainformation name --   
content     CDATA          #REQUIRED -- associated information --   
scheme      CDATA          #IMPLIED  -- select form of content --   > 

Start tag: required, End tag: forbidden

開始標籤:必須,結束標籤:禁止使用

Attribute definitions

屬性定義

For the following attributes, the permitted values and their interpretation are profile dependent:

對於下列屬性,其允許的取值以及它們的解釋依賴於其相關的profile:

name = name [CS]
This attribute identifies a property name. This specification does not list legal values for this attribute
該屬性標識一個屬性的名字。本規範沒有列出該屬性的合法取值.
content = cdata [CS]
This attribute specifies a property's value. This specification does not list legal values for this attribute
該屬性指定了屬性值。本規範沒有列出該屬性的合法取值。
scheme = cdata [CS]
This attribute names a scheme to be used to interpret the property's value (see the section on profiles for details)
該屬性給出了用於解析屬性值的方案(scheme)的名字,請參閱profile部分以獲得詳細信息。
http-equiv = name [CI]
This attribute may be used in place of the name attribute. HTTP servers use this attribute to gather information for HTTP response message headers
該屬性可以被用來頂替name屬性。HTTP服務器使用該屬性來蒐集關於HTTP響應消息頭信息。

Attributes defined elsewhere

在其他地方定義的屬性

The META element can be used to identify properties of a document (e.g., author, expiration date, a list of key words, etc.) and assign values to those properties. This specification does not define a normative set of properties.

META元素可以用來標識一個文檔的各種屬性以及對這些屬性進行賦值,例如:作者,過期日期,關鍵字列表等。本規範沒有定義一個正式的屬性集合。

Each META element specifies a property/value pair. The name attribute identifies the property and the content attribute specifies the property's value.

每一個META元素都包含一個屬性/值對。name屬性標識屬性名字,content屬性描述了改屬性的取值。

For example, the following declaration sets a value for the Author property:

<META name="Author" content="Dave Raggett">

The lang attribute can be used with META to specify the language for the value of the content attribute. This enables speech synthesizers to apply language dependent pronunciation rules.

例如,下面的聲明爲Auhtor屬性設置了一個值:

<META name="Author" content="Dave Raggett">
lang屬性可以在META中使用,其作用是指定content屬性的語言。這可以使語音合成器擁有根據語言應用發音規則的能力。

In this example, the author's name is declared to be French:

<META name="Author" lang="fr" content="Arnaud Le Hors">

下面的聲明例子展示了將作者名字是用法語給出的:

<META name="Author" lang="fr" content="Arnaud Le Hors">

Note. The META element is a generic mechanism for specifying meta data. However, some HTML elements and attributes already handle certain pieces of meta data and may be used by authors instead of META to specify those pieces: the TITLE element, the ADDRESS element, the INS and DEL elements, the title attribute, and the cite attribute.

註釋。META元素是指定元數據的一般機制。然而,一些HTML元素和屬性已經處理了相當部分的元數據,並且作者可以使用這些元素和屬性代替META來指定這些元數據。它們包括:TITLE元素,ADDRESS元素,INS及DEL元素,title屬性以及cite屬性。

Note. When a property specified by a META element takes a value that is a URI, some authors prefer to specify the meta data via the LINK element. Thus, the following meta data declaration:

<META name="DC.identifier"
      content="http://www.ietf.org/rfc/rfc1866.txt">

might also be written:

<LINK rel="DC.identifier"
         type="text/plain"
         href="http://www.ietf.org/rfc/rfc1866.txt">

註釋。當一個META元素所定義的屬性攜帶一個URI值時,一些作者更喜歡採用LINK元素來描述元數據。於是,下面的元數據聲明:

<META name="DC.identifier"       content="http://www.ietf.org/rfc/rfc1866.txt"> 

可以被寫成:

<LINK rel="DC.identifier"          type="text/plain"          href="http://www.ietf.org/rfc/rfc1866.txt">

META and HTTP headers
META元素和HTTP頭

The http-equiv attribute can be used in place of the name attribute and has a special significance when documents are retrieved via the Hypertext Transfer Protocol (HTTP). HTTP servers may use the property name specified by the http-equiv attribute to create an [RFC822]-style header in the HTTP response. Please see the HTTP specification ([RFC2616]) for details on valid HTTP headers.

當文檔是通過超文本傳輸協議(HTTP)進行獲取時,http-equiv屬性可以被用來代替name屬性,並且這樣做有特殊的好處。HTTP服務器可以使用http-equiv屬性所指定的屬性名在HTTP響應中創建一個RFC822形式的HTTP頭。

The following sample META declaration:

<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">

will result in the HTTP header:

Expires: Tue, 20 Aug 1996 14:25:27 GMT

This can be used by caches to determine when to fetch a fresh copy of the associated document.

下面的META聲明樣例:

<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">

將會在HTTP頭中形成如下文本:

Expires: Tue, 20 Aug 1996 14:25:27 GMT 

它可以被緩存用來決定何時去獲取相關文檔的新拷貝。

Note. Some user agents support the use of META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URI. Authors should not use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects.

註釋。一些用戶代理支持META的下列用法:在指定數量的秒數之後用一個不同的URI來刷新當前頁面。作者不應使用該項技術進行不同頁面的跳轉,因爲它會使頁面對某些用戶不可訪問。自動頁面跳轉的正確做法應該是使用服務器端的重定向。

META and search engines
META元素和搜索引擎

A common use for META is to specify keywords that a search engine may use to improve the quality of search results. When several META elements provide language-dependent information about a document, search engines may filter on the lang attribute to display search results using the language preferences of the user. 

META的一種常見的用法是指定關鍵字,這些關鍵字可以使搜索引擎改善檢索結果的質量。當關於一個文檔的多個語言相關的META元素被提供時,搜索引擎可以在lang屬性上做相應過濾來顯示符合用戶喜好的指定語言的檢索結果。

For example,

例如:

<-- For speakers of US English --> 
<META name="keywords" lang="en-us"           content="vacation, Greece, sunshine">
 <-- For speakers of British English --> 
<META name="keywords" lang="en"           content="holiday, Greece, sunshine">
 <-- For speakers of French -->
 <META name="keywords" lang="fr"           content="vacances, Gr&egrave;ce, soleil">

The effectiveness of search engines can also be increased by using the LINK element to specify links to translations of the document in other languages, links to versions of the document in other media (e.g., PDF), and, when the document is part of a collection, links to an appropriate starting point for browsing the collection.

搜索引擎的有效性也可以通過使用LINK元素來提升。這些LINK元素可以用來鏈接文檔其他語言的翻譯版本,其他介質版本(例如:PDF)以及在文檔是集合的一部分時,鏈接到瀏覽整個集合合適的起始點。

Further help is provided in the section on helping search engines index your Web site.

幫助搜索引擎索引你的網站部分提供了更進一步的幫助。

META and PICS
META和PICS

The Platform for Internet Content Selection (PICS, specified in [PICS]) is an infrastructure for associating labels (meta data) with Internet content. Originally designed to help parents and teachers control what children can access on the Internet, it also facilitates other uses for labels, including code signing, privacy, and intellectual property rights management.

互聯網內容選擇平臺(PICS)是一個將label(元數據)與Internet內容關聯的框架體系。最開始它是被設計成幫助父母和老師控制兒童可以訪問Inernet的資源,同時它也提供label的其他用途,包括代碼簽名,隱私以及知識產權管理。

This example illustrates how one can use a META declaration to include a PICS 1.1 label:

下面的例子展示瞭如何使用META聲明來包含PICS 1.1 label:

<HEAD>
 
<META http-equiv="PICS-Label" 
content='
 (PICS-1.1 "http://www.gcf.org/v2.5"
    labels on "1994.11.05T08:15-0500"
      until "1995.12.31T23:59-0000"
      for "http://w3.org/PICS/Overview.html"
    ratings (suds 0.5 density 0 color/hue 1))
 '>


  <TITLE>
... document title ...
</TITLE> </HEAD>
META and default information
META和缺省信息

The META element may be used to specify the default information for a document in the following instances:

META元素可以被用來指定文檔的下列缺省信息:

  • 缺省的Script腳本語言
  • 缺省的樣式表語言
  • 文檔字符編碼

 

The following example specifies the character encoding for a document as being ISO-8859-5

下面的例子爲文檔指定了缺省的字符編碼機制ISO-8859-5

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-5">

Meta data profiles

元數據profile(肖像)

The profile attribute of the HEAD specifies the location of a meta data profile. The value of the profile attribute is a URI. User agents may use this URI in two ways:

HEAD元素的profile屬性指定了一個元數據profile的地址。profile屬性的值是一個URI。用戶代理可以用如下兩種方式來使用此URI:
  • As a globally unique name. User agents may be able to recognize the name (without actually retrieving the profile) and perform some activity based on known conventions for that profile. For instance, search engines could provide an interface for searching through catalogs of HTML documents, where these documents all use the same profile for representing catalog entries
  • 作爲全局唯一名字。用戶代理可能不用真正檢索相應的profile,就有能力識別出這個名字,並且可以基於對這個profile已知的一些約定來實施一些 動作。舉個例子,在所有文檔都使用了同樣的profile來表示分類實體時,搜索引擎可以提供有一個在HTML文檔的分類內進行搜索的接口,
  • As a link. User agents may dereference the URI and perform some activity based on the actual definitions within the profile (e.g., authorize the usage of the profile within the current HTML document). This specification does not define formats for profiles.
  • 作爲連接。用戶代理可以解除URI引用然後基於其在profile內的實際定義執行一些動作。例如,允許在當前文檔內使用profile。本規範沒有定義profile的格式。

This example refers to a hypothetical profile that defines useful properties for document indexing. The properties defined by this profile -- including "author", "copyright", "keywords", and "date" -- have their values set by subsequent META declarations.

下面的例子引用到一個假定的profile,該profile定義了很多對文檔索引有用的屬性:它們包括 "author", "copyright", "keywords", and "date"。這些屬性的值通過一系列META聲明來設置。

 <HEAD profile="http://www.acme.com/profiles/core"> 
  <TITLE>How to complete Memorandum cover sheets</TITLE>
 <META name="author" content="John Doe">
 <META name="copyright" content="&copy; 1997 Acme Corp.">
 <META name="keywords" content="corporate,guidelines,cataloging">
 <META name="date" content="1994-11-06T08:49:37+00:00"> 
 </HEAD> 

As this specification is being written, it is common practice to use the date formats described in [RFC2616], section 3.3. As these formats are relatively hard to process, we recommend that authors use the [ISO8601] date format. For more information, see the sections on the INS and DEL elements.

當本規範正在撰寫時,使用在[RFC2616]3.3部分中描述的日期格式是一種業內通用的做法。由於這些格式相對來說比較難處理,我們建議作者使用[ISO8601]的日期格式。請參看INS和DEL元素的相關部分以獲取更多信息。

The scheme attribute allows authors to provide user agents more context for the correct interpretation of meta data. At times, such additional information may be critical, as when meta data may be specified in different formats. For example, an author might specify a date in the (ambiguous) format "10-9-97"; does this mean 9 October 1997 or 10 September 1997? The scheme attribute value "Month-Day-Year" would disambiguate this date value.

scheme 屬性允許作者向用戶代理提供關於如何正確解析元數據的更多上下文環境。當元數據可能用不同的格式進行指定時,這樣的附加信息可能是必須的。例如作者可能用 “10-9-97”這種二義性的格式裏表示一個日期,該日期是表示1997年10月9日還是表示1997年9月10日?如果將scheme屬性值設置爲 “Month-Day-Year”就可以解除這個日期值的二義性。

At other times, the scheme attribute may provide helpful but non-critical information to user agents.

在另外的一些時候,schema屬性可以想用戶代理提供雖然不是關鍵的但很有用的信息。

 

For example, the following scheme declaration may help a user agent determine that the value of the "identifier" property is an ISBN code number:

<META scheme="ISBN"  name="identifier" content="0-8230-2355-9">

Values for the scheme attribute depend on the property name and the associated profile.

例如,下面的scheme聲明可以幫助用戶代理判定"identifier"屬性是一個ISBN編碼數字:

<META scheme="ISBN"  name="identifier" content="0-8230-2355-9">

scheme屬性的取值依賴於屬性名及其相關聯的profile。

Note. One sample profile is the Dublin Core (see [DCORE]). This profile defines a set of recommended properties for electronic bibliographic descriptions, and is intended to promote interoperability among disparate description models.

註釋。一個profile實際例子是Dublin Core。該profile定義了一組建議用於電子數目表述的屬性。該profile試圖爲該領域內不同描述模型提供互操作能力。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章