Internet Engineering Task Force (IETF) N. Freed Request for Comments: 5784 S. Vedam Category: Standards Track Sun Microsystems ISSN: 2070-1721 March 2010
Sieve Email Filtering: Sieves and Display Directives in XML
Abstract
抽象
This document describes a way to represent Sieve email filtering language scripts in XML. Representing Sieves in XML is intended not as an alternate storage format for Sieve but rather as a means to facilitate manipulation of scripts using XML tools.
この文書は、XMLでふるいのメールフィルタリング言語スクリプトを表現する方法を説明します。 XMLで表現ふるいはないふるいのための代替ストレージ形式としてではなく、XMLツールを使用してスクリプトの操作を容易にする手段として意図されています。
The XML representation also defines additional elements that have no counterparts in the regular Sieve language. These elements are intended for use by graphical user interfaces and provide facilities for labeling or grouping sections of a script so they can be displayed more conveniently. These elements are represented as specially structured comments in regular Sieve format.
XML表現は、通常のふるい言語には対応していない追加要素を定義します。これらの要素は、グラフィカル・ユーザ・インターフェースにより使用するためのものと標識又はそれらがより便利に表示することができるように、スクリプトのセクションをグループ化するための機能を提供しています。これらの要素は、通常のふるい形式で特別に構造化されたコメントとして表現されています。
Status of This Memo
このメモのステータス
This is an Internet Standards Track document.
これは、インターネット標準化過程文書です。
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.
このドキュメントはインターネットエンジニアリングタスクフォース(IETF)の製品です。これは、IETFコミュニティの総意を表しています。これは、公開レビューを受けており、インターネットエンジニアリング運営グループ(IESG)によって公表のために承認されています。インターネット標準の詳細については、RFC 5741のセクション2で利用可能です。
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc5784.
このドキュメントの現在の状態、任意の正誤表、そしてどのようにフィードバックを提供するための情報がhttp://www.rfc-editor.org/info/rfc5784で取得することができます。
Copyright Notice
著作権表示
Copyright (c) 2010 IETF Trust and the persons identified as the document authors. All rights reserved.
著作権(C)2010 IETF信託とドキュメントの作成者として特定の人物。全著作権所有。
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
この文書では、BCP 78と、この文書の発行日に有効なIETFドキュメント(http://trustee.ietf.org/license-info)に関連IETFトラストの法律の規定に従うものとします。彼らは、この文書に関してあなたの権利と制限を説明するように、慎重にこれらの文書を確認してください。コードコンポーネントは、トラスト法規定のセクションで説明4.eおよび簡体BSDライセンスで説明したように、保証なしで提供されているよう簡体BSDライセンスのテキストを含める必要があり、この文書から抽出されました。
Table of Contents
目次
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Conventions Used in This Document . . . . . . . . . . . . . . 4 3. Grammatical Structure of Sieve . . . . . . . . . . . . . . . . 4 4. XML Representation of Sieve . . . . . . . . . . . . . . . . . 6 4.1. XML Display Directives . . . . . . . . . . . . . . . . . . 9 4.2. Structured Comments . . . . . . . . . . . . . . . . . . . 10 4.3. Validation . . . . . . . . . . . . . . . . . . . . . . . . 11 5. Security Considerations . . . . . . . . . . . . . . . . . . . 11 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 12 7.1. Normative References . . . . . . . . . . . . . . . . . . . 12 7.2. Informative References . . . . . . . . . . . . . . . . . . 13 Appendix A. Extended Example . . . . . . . . . . . . . . . . . . 14 Appendix B. XML Schema for Sieves in XML . . . . . . . . . . . . 21 Appendix C. Relax NG Schema for Sieves in XML . . . . . . . . . . 24 Appendix D. Stylesheet for Conversion from XML . . . . . . . . . 26 Appendix E. Acknowledgements . . . . . . . . . . . . . . . . . . 32
Sieve [RFC5228] is a language for filtering email messages at or around the time of final delivery. It is designed to be implementable on either a mail client or mail server. It is meant to be extensible, simple, and independent of access protocol, mail architecture, and operating system, and it is intended to be manipulated by a variety of different user interfaces.
ふるい[RFC5228]は、最終的な配達の時や周りの電子メールメッセージをフィルタリングするための言語です。メールクライアントまたはメールサーバーのいずれかで実施可能となるように設計されています。拡張可能なシンプル、およびアクセスプロトコル、メール・アーキテクチャ、およびオペレーティングシステムとは独立であることを意味し、これは、異なるユーザインターフェースの種々によって操作されることを意図しています。
Some user interface environments have extensive existing facilities for manipulating material represented in XML [XML]. While adding support for alternate data syntaxes may be possible in most if not all of these environments, it may not be particularly convenient to do so. The obvious way to deal with this issue is to map Sieves into XML, possibly on a separate back-end system, manipulate the XML, and convert it back to normal Sieve format.
一部のユーザーインターフェース環境は、[XML] XMLで表現材料を操作するための大規模な既存の設備を持っています。代替データ構文のサポートを追加することがすべてではないこれらの環境のほとんどで可能かもしれないが、そうすることは、特に便利ではないかもしれません。この問題に対処するための明白な方法は、おそらく別のバックエンドシステムに、XMLにふるいをマップXMLを操作して、正常に戻っふるい形式に変換することです。
The fact that conversion into and out of XML may be done as a separate operation on a different system argues strongly for defining a common XML representation for Sieve. This way, different front-end user interfaces can be used with different back-end mapping and storage facilities.
XMLから変換は、異なるシステム上で別の操作として行うことができるという事実は、ふるいのための共通のXML表現を定義するために強く主張しています。この方法は、異なるフロントエンドユーザインターフェースは、異なるバックエンド・マッピング及び貯蔵施設を使用することができます。
Another issue with the creation and manipulation of Sieve scripts by user interfaces is that the language is strictly focused on describing email filtering operations. The language contains no mechanisms for indicating how a given script should be presented in a user interface. Such information can be represented in XML very easily, so it makes sense to define a framework to do this as part of the XML format. A structured comment convention is then used to retain this information when the script is converted to normal Sieve format.
ユーザーインターフェイスにより、Sieveスクリプトの作成と操作を持つもう一つの問題は、言語は、電子メールフィルタリング動作を説明するに厳密に焦点を当てていることです。言語は、指定されたスクリプトは、ユーザインターフェースに提示されるべきかを示すためのメカニズムを含んでいません。このような情報は非常に簡単にXMLで表現することができるので、XML形式の一部としてこれを行うためのフレームワークを定義するために理にかなっています。構造化されたコメントの大会は、スクリプトは、通常のふるい形式に変換されたときに、この情報を保持するために使用されます。
It should be noted, however, that the ability for different front ends to use the same mapping and storage facilities does not mean that the additional XML information produced by different front ends will interoperate.
異なるフロントが同じマッピングおよび貯蔵施設を使用することを終了するために能力が異なるフロントエンドによって生成追加のXML情報を相互運用することを意味しないことに留意すべきです。
Various Sieve extensions have already been defined, e.g., [RFC5183], [RFC5229], [RFC5230], [RFC5231], [RFC5232], [RFC5233], [RFC5235], [RFC5293], and more are planned. The set of extensions available varies from one implementation to the next and may even change as a result of configuration choices. It is therefore essential that the XML representation of Sieve be able to accommodate Sieve extensions without requiring schema changes. It is also desirable that Sieve extensions not require changes to the code that converts to and from the XML representation.
種々のふるい拡張は既に、例えば、[RFC5183]、[RFC5229]、[RFC5230]、[RFC5231]、[RFC5232]、[RFC5233]、[RFC5235]、[RFC5293]、および複数が計画され、定義されています。利用可能な拡張機能のセットは、1つの実装から次へと変化し、さらに構成の選択の結果として変化してもよいです。ふるいのXML表現は、スキーマの変更を必要とせずにふるいの拡張に対応できることが不可欠です。ふるいの拡張は、XML表現にしてから変換するコードを変更する必要がないことも望ましいです。
This specification defines an XML representation for Sieve scripts and explains how the conversion process to and from XML works. The XML representation is capable of accommodating any future Sieve extension as long as the underlying Sieve grammar remains unchanged. Furthermore, code that converts from XML to the normal Sieve format requires no changes to accommodate extensions, while code used to convert from normal Sieve format to XML only requires changes when new control commands are added -- a rare event. An XML Schema, Relax NG Schema, and a sample stylesheet to convert from XML format are also provided in the appendices.
この仕様は、SieveスクリプトのためのXML表現を定義し、XMLの作品にしてからどのように変換プロセスを説明します。 XML表現は限り根本的なふるい文法が変わらないよう、将来ふるい拡張を収容することができます。まれなイベント - 新しい制御コマンドが追加されたときにXMLに通常ふるいフォーマットから変換するために使用されるコードは変更のみを必要としながら、さらに、通常のふるい形式にXMLから変換したコードは、拡張機能に対応するために変更する必要はありません。 XMLスキーマ、NGスキーマをリラックスし、XMLフォーマットへ変換するためのサンプルスタイルシートも付録に提供されます。
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].
この文書のキーワード "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", および "OPTIONAL" はRFC 2119 [RFC2119]に記載されているように解釈されます。
The term "processor" is used throughout this document to refer to agents that convert Sieve to and from the XML representation. The term "editor" refers to agents that operate on, possibly creating or modifying, Sieves in XML format.
用語「プロセッサ」およびXML表現からふるいを変換する薬剤を指すために本明細書を通じて使用されています。用語「編集者」とは、上で動作するエージェント、おそらく作成または変更、XML形式のふるいを指します。
The Sieve language is designed to be highly extensible without making any changes to the basic language syntax. Accordingly, the syntax of Sieve, defined in Section 8 of [RFC5228], is entirely structural in nature and employs no reserved words of any sort.
ふるい言語は基本言語の構文を変更することなく、高度に拡張できるように設計されています。したがって、[RFC5228]のセクション8で定義されたふるいの構文は、本質的に完全な構造であり、いかなる種類の予約語を使用しません。
Structurally, a Sieve script consists of a series of commands. Each command, in turn, consists of an identifier, zero or more arguments, an optional test or test-list, and finally an optional block containing another series of commands. Commands are further broken down into controls and actions, although this distinction cannot be determined from the grammar.
構造的には、Sieveスクリプトは、一連のコマンドで構成されています。各コマンドは、今度は、識別子、ゼロ以上の引数、オプションのテストまたはテストリスト、およびコマンドの別のシリーズを含む、最終的に任意のブロックから構成されています。この区別は、文法から決定することはできないがコマンドはさらに、コントロールおよびアクションに分解されます。
Some example Sieve controls are:
いくつかの例ふるいコントロールは、次のとおりです。
stop; <-- No arguments, test, or command block require "fileinto"; <-- Control with a single argument if true {stop;} <-- Control with test and command block
やめる; < - 引数なしでは、テスト、またはコマンドブロックは、「のfileinto」を必要としません。 < - 単一引数をコントロールしている場合、{ストップ;}真< - テストおよびコマンドブロックとコントロール
Some examples of Sieve actions are:
ふるいアクションのいくつかの例は以下のとおりです。
discard; <-- Action with no arguments, test, or command block fileinto "folder"; <-- Action with an argument
捨てます; < - 「フォルダ」のfileinto引数なし、テスト、またはコマンド・ブロックとアクション。 < - 引数を指定したアクション
At the time of this writing, there are no controls defined that accept both arguments and a test. Similarly, there are currently no defined actions that allow either a test or a command block. Nevertheless, the Sieve grammar allows such constructs to be defined by some future extension.
この記事の執筆時点では、引数とテストの両方を受け入れる定義されたコントロールはありません。同様に、テストまたはコマンドブロックのいずれかを可能に何ら規定されたアクションは、現在存在しません。それにもかかわらず、ふるい文法は、そのような構築物は、いくつかの将来の拡張によって定義することができます。
A test consists of an identifier followed by zero or more arguments, then another test or test-list. Unlike commands, tests cannot be followed by a command block.
試験は、ゼロ以上の引数は、別のテストまたはテストリストが続く識別子から成ります。コマンドとは異なり、テストは、コマンドブロックが続くことはできません。
Here are some examples of Sieve tests. Note that such tests have to appear as part of a command in order to be syntactically valid:
ここでふるいテストのいくつかの例があります。このようなテストは、構文的に有効であるためには、コマンドの一部として表示する必要があることに注意してください:
true <-- Test with no argument or subordinate test envelope "to" "me@example.com" <-- Test with several arguments header :is "from" "you@example.com" <-- Test with tagged argument
真< - テストは、引数なしまたは下位試験エンベロープと「me@example.com「から」:タグ付けされた引数でテスト - - 」から「you@example.com」<「<いくつかの引数を持つテストヘッダです」
Command or test arguments can be either string lists, whole numbers, or tags. (Tags are simply identifiers preceded by a colon.) Note that although the Sieve grammar treats single strings as a degenerate case of a string list, some tests or actions have arguments that can only be individual strings, not lists.
コマンドまたはテスト引数は、文字列のリスト、整数、またはタグのいずれかになります。 (タグは、単にコロンが先行識別子です。)ふるい文法は文字列リストの退化ケースとして単一の文字列を扱いますが、いくつかのテストやアクションが唯一の個々の文字列ではなく、リストすることができ、引数を持っていることに注意してください。
Here is an example showing the use of both a test-list and a string list:
ここで、テストリストと列リストの両方の使用を示す例です。
if anyof (not exists ["From", "Date"], header :contains "from" "fool@example.edu") { discard; }
anyof場合は([、「日付」「から」]が存在しない、ヘッダが「fool@example.edu」「から」が含ま){破棄する。 }
Extensions can add new controls, actions, tests, or arguments to existing controls or actions. Extensions have also changed how string content is interpreted, although this is not relevant to this specification. However, it is especially important to note that so far, only one of the many defined Sieve extensions -- the foreverypart extension [RFC5703] -- has added new controls to the language. It seems safe to assume that, due to their nature, future addition of controls will be relatively rare.
拡張機能は、既存のコントロールやアクションに新しいコントロール、アクション、テスト、または引数を追加することができます。文字列の内容がどのように解釈されるか、これはこの仕様には関係ありませんが、拡張機能も、変更されています。 foreverypart拡張[RFC5703]は - - 言語に新しいコントロールを追加しましたしかし、これまでのところ、多くの一方のみがふるいの拡張を定義していることに注意することが特に重要です。その性質上、コントロールの将来の追加は比較的まれだろう、と仮定しても安全と思われます。
Finally, comments are allowed between lexical elements in a Sieve script. One important use case for comments is encoding meta-data about the script, a facility that is lacking in the Sieve language. Therefore, comments need to be preserved in the XML representation.
最後に、コメントはSieveスクリプトで字句要素の間に許可されています。コメントのための一つの重要なユースケースは、スクリプトに関するメタデータ、ふるい言語に欠けている機能をエンコードしています。そのため、コメントはXML表現に保存する必要があります。
Sieve controls and actions are represented in XML as "control" or "action" elements, respectively. The command's identifier appears as a name attribute on the element itself. This is the only attribute allowed on controls and actions -- arguments, tests, test-lists, and nested command blocks are all represented as nested elements. While naming the element after the control or action itself may seem like a better choice, doing so would result in extensions requiring frequent corresponding schema changes.
ふるいコントロールとアクションは、それぞれ、「コントロール」または「アクション」要素としてXMLで表現されています。コマンドの識別子は、要素自体の名前属性として表示されます。これは、コントロールとアクションに許可された唯一の属性である - 引数、テスト、テスト・リスト、およびネストされたコマンド・ブロックは、すべてのネストした要素として表現されます。コントロールまたはアクション自体後の要素を命名することは、より良い選択のように見えるかもしれませんが、そうすることは頻繁に対応するスキーマの変更を必要とする機能拡張につながります。
The example Sieve controls shown in the previous section would be represented as these XML fragments:
前のセクションで示した例ふるいコントロールは、これらのXMLフラグメントとして表現されます。
<control name="stop"/>
<コントロール名= "ストップ" />
<control name="require"><str>fileinto</str></control>
<コントロール名= "必要"> <STR>のfileinto </ STR> </制御>
<control name="if"> <test name="true"/><control name="stop"/> </control>
<コントロール名= "もし"> <テスト名= "真" /> <コントロール名= "ストップ" /> </制御>
The example Sieve actions shown above would appear in XML as:
上記の例ふるいアクションは、XMLなどに表示されます:
<action name="discard"/> <action name="fileinto"><str>folder</str></action>
<アクション名= "捨てる" /> <アクション名= "のfileinto"> <STR>フォルダ</ STR> </アクション>
The separation of controls from actions in the XML representation means that conversion from normal Sieve format to XML has to be able to distinguish between controls and actions. This is easily done by maintaining a list of all known controls since experience indicates new controls are rarely added. At the time of this writing, the list of defined controls consists of:
XML表現のアクションからの制御の分離は、通常のふるいフォーマットからXMLへの変換は、コントロールとアクションとを区別することができなければならないことを意味します。これは、簡単に経験はめったに追加されていない新しいコントロールを示しているため、すべての知られているコントロールのリストを維持することによって行われます。この記事の執筆時点では、定義されたコントロールのリストは、から構成されています。
It should be noted that with this approach unknown controls will simply be treated as actions and can be passed back and forth between the two representations. The treatment of a control as an action is unlikely to cause other issues since knowledge of a control's language semantics is almost always required to take advantage of it.
このアプローチで、未知のコントロールは、単にアクションとして扱われ、2つの表現の間で前後に渡すことができることに留意すべきです。コントロールの言語の意味論の知識はほとんど常にそれを利用するために必要とされているので、アクションなどの制御の治療は、他の問題を引き起こすことはほとんどありません。
Tests are represented in the same basic way as controls and actions, that is, as a "test" element with a name attribute giving the test identifier. For example, the following XML fragments show various types of tests:
テストは、テスト識別子を与えるname属性を持つ「テスト」の要素として、あるコントロールとアクションと同じ基本的な方法で表現されています。たとえば、次のXMLフラグメントは、テストの様々なタイプを示しています。
<test name="true"/>
<テスト名= "真" />
<test name="envelope"/> <str>to</str><str>me@example.com</str> </test>
<テスト名= "封筒" /> <STR>に</ STR> <STR> me@example.com </ STR> </テスト>
<test name="header"/> <tag>is</tag><str>from</str><str>you@example.com</str> </test>
<試験名= "ヘッダ" /> <タグ>である</タグ> <STR>から</ STR> <STR> you@example.com </ STR> </試験>
String, number, and tag arguments are represented as "str", "num", and "tag" elements, respectively. The actual string, number, or tag identifier appears as text inside the element. None of these elements have any defined attributes. Several examples of arguments have already appeared in the preceding control, action, and test examples. Any whitespace in the str body content MUST be preserved by the processor. Also, note that since strings and tags are represented as element text, any quotes or other syntactic elements required in the regular Sieve representation are dropped rather than being carried over into the XML.
文字列、番号、及びタグの引数は、それぞれ、「STR」、「NUM」、および「タグ」の要素として表されます。実際の文字列、数値、またはタグ識別子は、要素内のテキストとして表示されます。これらの要素のいずれも、定義された属性を持っていません。引数のいくつかの例は、すでに前回の制御、アクション、および試験例に登場しています。 STRボディコンテンツ内の任意の空白は、プロセッサによって保存されなければなりません。また、文字列とタグは要素のテキストとして表現されているので、通常のふるい表現に必要な引用符や他の構文要素は、XMLに引き継がれているのではなく、ドロップされることに注意してください。
String list arguments are represented as a "list" element, which in turn contains one or more str elements. Note that this allows the distinction between a single string and a string list containing a single string to be preserved. This is not essential since a list containing a single string could simply be mapped to a string, but it seems prudent to maintain the distinction when mapping to and from XML.
文字列リストの引数は順番に一つ以上のstrの要素が含まれ、「リスト」の要素として表現されています。これは、単一の文字列と単一の文字列を含む文字列のリストとの間の区別が保持されることを可能にすることに留意されたいです。単一の文字列を含むリストは、単に文字列にマッピングすることができので、これは必須ではないが、XMLにしてからマッピングする際の区別を維持するのが賢明と思われます。
Nested command blocks appear as a series of control or action elements inside of an outer control or action element. No block element is needed since an inner command block can only appear once and only after any arguments, tests, or test-lists. For example:
ネストされたコマンド・ブロックは、外部制御またはアクション要素の内部制御または作用要素の系列として現れます。内部コマンドブロックのみを任意の引数、テスト、またはテスト・リストの後に一度だけ表示されますので、いかなるブロック要素は必要ありません。例えば:
<control name="if"> <test name="anyof"> <test name="not"> <test name="exists"> <list><str>From</str><str>Date</str></list> </test> </test> <test name="header"> <tag>contains</tag> <str>from</str> <str>fool@example.edu</str> </test> </test> <action name="discard"/> </control>
<コントロール名= "もし"> <テスト名= "anyof"> <テスト名= "ない"> <テスト名は= "存在"> <リスト> <STR> </ STR> <STR>日付</ STRから> </リスト> </試験> </試験> <テスト名= "ヘッダ"> <タグ>から</タグ> <STR>を含む</ STR> <STR> fool@example.edu </ STR> < /テスト> </テスト> <アクション名= "捨てる" /> </制御>
Sieve comments are mapped to a special "comment" element in XML. Both hash and bracketed comments are mapped to the same construct so the distinction between the two is lost in XML. XML comments are not used because some XML tools do not make it convenient to access comment nodes.
ふるいコメントはXMLで特別な「コメント」の要素にマッピングされます。ハッシュおよび括弧コメントの両方がので、2つの区別がXMLで失われる同じ構築物にマッピングされます。いくつかのXMLツールは、それが便利コメントノードにアクセスするために作成していないので、XMLのコメントは使用されません。
Comments are allowed between commands and inside "test" elements. But comments aren't allowed directly inside commands -- due to limitations of XML Schema, special enclosing "preamble" and "postamble" elements are needed:
コメントはコマンドと内部の「テスト」の要素の間で許可されています。 :、原因XMLスキーマの制限のために特別囲んで「前文」と「ポストアンブル」の要素が必要とされている - しかし、コメントは、コマンド内で直接許可されていません
<control name="if"> <preamble> <comment>Check to see if message should be discarded</comment> </preamble> <test name="anyof"> <test name="not"> <test name="exists"> <list><str>From</str><str>Date</str></list> </test> </test> <test name="header"> <tag>contains</tag> <str>from</str> <str>fool@example.edu</str> </test> </test> <action name="discard"/> <postamble> <comment>End of discard check</comment> </postamble> </control>
<コントロール名=「もし」> <前文> <コメント>メッセージは破棄されるべきかどうかを確認してください</コメント> </プリアンブル> <テスト名=「anyof」> <テスト名=「ない」> <テスト名= > <リスト> <STR>から</ STR> <STR>日付</ STR> </リスト> </試験> </試験> <テスト名= "ヘッダ"> <タグ>を含む</タグ "存在"廃棄小切手の> <STR>から</ STR> <STR> fool@example.edu </ STR> </テスト> </テスト> <アクション名= "捨てる" /> <ポストアンブル> <コメント>終了</コメント> </ポストアンブル> </制御>
Sometimes graphical user interfaces are a convenient way to provide Sieve management functions to users. These interfaces typically summarize/annotate/group/display Sieve script(s) in an intuitive way for end users.
時々、グラフィカル・ユーザー・インターフェースは、ユーザーにふるい管理機能を提供するのに便利な方法です。これらのインターフェースは、典型的には、エンドユーザーの直感的な方法で/注釈/グループ/表示Sieveスクリプト(複数可)を要約します。
To do this effectively, the graphical user interface may require additional information about the Sieve script itself. That information or "meta-data" might include, but is not limited to, a Sieve name (identifying the current Sieve), whether the Sieve is enabled or disabled, and the order in which the parts of the Sieve are presented to the user. The graphical user interface may also choose to provide mechanisms to allow the user to modify the script.
これを効果的に行うために、グラフィカル・ユーザー・インターフェースは、Sieveスクリプト自体についての追加情報が必要な場合があります。その情報又は「メタデータ」が含まれる場合があり、これらに限定されないが、(現在のふるいを識別する)ふるい名、ふるいが有効であるか無効であるか、篩の部分がユーザに提示される順序。グラフィカルユーザインタフェースは、ユーザがスクリプトを変更することを可能にする機構を提供することを選択することができます。
It is often useful for a graphical user interface to group related Sieve script elements and provide an interface that displays these groups separately so they can be managed as a single object. Some examples include Sieve statements that together provide vacation responders, blacklists/whitelists, and other types of filtering controls.
それは、多くの場合、グループに関連するSieveスクリプト要素へのグラフィカル・ユーザー・インターフェースのために有用であり、それらは単一のオブジェクトとして管理できるように、これらのグループ別々に表示するインタフェースを提供します。いくつかの例としては、ふるい一緒に休暇の応答を提供文、ブラックリスト/ホワイトリスト、およびフィルタリングのコントロールの他のタイプがあります。
Some advanced graphical user interfaces may even provide a natural language representation of a Sieve script and/or an advanced interface to present Sieve statements directly to the user.
いくつかの先進的なグラフィカル・ユーザ・インターフェースもSieveスクリプトおよび/またはユーザに直接ふるい文を提示するための高度なインターフェースの自然言語表現を提供することができます。
A graphical user interface may also choose to support only a subset of action commands in the Sieve language (and its extensions), and so a mechanism to indicate the extent of support and characterize the relationships between those supported action commands and the test (with its arguments) is immensely useful and probably required for clients that may not have complete knowledge of Sieve grammar and semantics.
グラフィカルユーザインターフェースは、アクション篩言語のコマンド(およびその拡張)のサブセットのみをサポートすることを選択することができ、したがって機構は、支持の程度を示すためとで(これらのサポートされているアクションコマンドと試験との間の関係を特徴づけるその引数は)非常に便利な、おそらくふるい文法と意味論の完全な知識を持っていないクライアントのために必要です。
The Sieve language contains no mechanisms for indicating how a given script should be presented in a user interface. The language also does not contain any specific mechanisms to represent other sorts of meta-data about the script. Providing support for such meta-data as part of a Sieve script is currently totally implementation specific and is usually done by imposing some type of structure on comments.
ふるい言語は、与えられたスクリプトは、ユーザインターフェースに提示されるべきかを示すために何のメカニズムを含んでいません。言語は、スクリプトに関するメタデータの他の種類を表すために、任意の特定のメカニズムが含まれていません。 Sieveスクリプトの一部として、このようなメタデータのサポートを提供することは、現在完全に実装固有のものであり、通常、コメントに構造のいくつかのタイプを課すことによって行われます。
However, such information can be represented in XML very easily, so it makes sense to define a framework to do this as part of the XML format. Implementations MAY choose to use structured comments to retain this information when the script is converted to normal Sieve format.
しかし、そのような情報は非常に簡単にXMLで表現することができるので、XML形式の一部としてこれを行うためのフレームワークを定義するために理にかなっています。実装は、スクリプトは、通常のふるい形式に変換されたときに、この情報を保持するために構造化されたコメントを使用することもできます。
The sample schemata for the XML representation of Sieve allows XML in foreign namespaces to be inserted in the same places "comment" elements can appear in Sieve scripts. This is the preferred means of including additional information. Alternately, the schema defines two display directives -- displayblock and displaydata -- as containers for meta-data needed by graphical user interfaces.
ふるいのXML表現のためのサンプルスキーマは、外国の名前空間でXMLが同じ場所に挿入されることを可能にする「コメント」の要素は、Sieveスクリプトで表示されます。これは、追加情報を含むの好ましい手段です。 displayblockとdisplaydata - - グラフィカル・ユーザ・インターフェースによって必要とされるメタデータのための容器として、交互に、スキーマは、二つの表示指令を定義しています。
Editors MAY use displayblock, displaydata, and foreign namespaces to associate meta-data. Some editors find it inconvenient to preserve this additional data during an editing session. Editors MAY preserve this data during an editing session for compatibility with other editors.
編集者は、メタデータを関連付けることdisplayblock、displaydata、および外国の名前空間を使用するかもしれません。一部のエディタは、それが不便編集セッション中にこの追加データを保存するために見つけます。編集者は、他のエディタとの互換性のための編集セッション中にこのデータを保存することができます。
The displayblock element can be used to enclose any number of Sieve statements at any level. It is semantically meaningless to the Sieve script itself. It allows an arbitrary set of attributes. Implementations MAY use this to provide many simple, display-related meta-data for the Sieve such as Sieve identifier, group identifier, order of processing, etc.
displayblock要素は、任意のレベルでふるい文の任意の数を囲むために使用することができます。これは、Sieveスクリプト自体に意味的に無意味です。これは、属性の任意のセットすることができます。実装は等ふるい識別子、グループ識別子、処理の順序、などふるいのための多くの単純な、ディスプレイ関連のメタデータを提供するためにこれを使用するかもしれ
The displaydata element supports any number of arbitrary child elements. Implementations MAY use this to represent complex data about that Sieve such as a natural language representation of Sieve or a way to provide the Sieve script directly.
displaydata要素は、任意の子要素の任意の数をサポートしています。実装は、このようなふるいの自然言語表現または直接Sieveスクリプトを提供する方法として、そのふるいに関する複雑なデータを表現するためにこれを使用するかもしれません。
Since the XML representation is not intended as a storage format, there needs to be a way to preserve the additional information that can be included in the XML representation in the normal Sieve syntax. This is done through the use of three structured comment conventions:
XML表現が記憶フォーマットとして意図されていないので、通常のふるい構文のXML表現に含めることができる追加情報を保存する方法が必要です。これは、3つの構造化コメントの規則を使用して行われます。
1. XML content in other namespaces is placed in Sieve bracketed comments beginning with the string "/* [/" and ending with the string "/] */".
2. The content of displaydata elements is placed in Sieve bracketed comments beginning with the string "/* [|" and ending with the string "|] */".
3. The beginning of a displayblock element is mapped to a bracketed Sieve comment beginning with the string "/* [*", which then lists any displayblock attribute names and values in XML format. The end of a displayblock element is mapped to a comment of the form "*] */".
Processors MUST preserve the additional information allowed in the XML format and SHOULD use the structured comment format shown above.
プロセッサは、XML形式で許可され、追加情報を保存しなければなりませんし、上に示した構造化されたコメントの形式を使用する必要があります。
Note: If "*/" is found in the XML content, when mapped into a comment, it would prematurely terminate that comment. Escaping this sequence would often be inconvenient for processors. Editors SHALL NOT include "*/" within displayblock, displaydata, or foreign markup. Processors MAY regard documents containing "*/" in foreign markup, displayblock, or displaydata as invalid.
注意:コメントにマッピングされたときに「* /」、XMLコンテンツで発見された場合、それが途中でそのコメントを終了します。このシーケンスをエスケープすることは、多くの場合、プロセッサにとっては不便だろう。編集者はdisplayblock、displaydata、または外国のマークアップの中に「* /」が含まれないものとします。プロセッサは、外国のマークアップ、displayblock、またはdisplaydata無効としての「* /」を含む文書を考えるかもしれません。
A processor MAY validate documents against a schema, and it MAY reject any that do not conform. For any document that a processor does not reject as invalid, any markup that the processor cannot understand by reference to this specification MAY be discarded.
プロセッサは、スキーマに対して文書を検証することができる、それが適合していないと任意のを拒否することがあります。プロセッサは無効として拒否しない任意の文書の場合は、プロセッサはこの仕様を参照することで理解することはできません任意のマークアップが破棄されることがあります。
Note that example Relax NG and XML Schema are given in the appendices below.
その一例がNGとXMLスキーマは、以下の付録に記載されているリラックスに注意してください。
Any syntactically valid Sieve script can be represented in XML. Accordingly, all security considerations applicable to Sieve and any extensions used also apply to the XML representation.
どれ構文的に有効なSieveスクリプトは、XMLで表現することができます。したがって、ふるいに適用されるすべてのセキュリティ上の考慮事項と任意の拡張子もXML表現に適用されます使用。
The use of XML carries its own security risks. Section 7 of RFC 3470 [RFC3470] discusses these risks.
XMLの使用は、独自のセキュリティリスクを運びます。 RFC 3470のセクション7 [RFC3470]は、これらのリスクについて説明します。
It is axiomatic that a Sieve editor must be trusted to do what the user specifies. If XML formats are used, this trust necessarily must extend to the components involved in converting to and from XML format.
ふるいエディタは、ユーザーが指定するものを行うために、信頼されなければならないことは自明です。 XMLフォーマットを使用する場合、この信頼は必ずしもXML形式からの変換に関与するコンポーネントに拡張する必要があります。
Arbitrary data can be included using other namespaces or placed in the extensible displayblock and displaydata constructs defined in this specification, possibly including entire scripts and other executable content in languages other than Sieve. Such material will necessarily have its own security considerations, which are beyond the scope of this document.
任意のデータは、他の名前空間を使用して含めるか、または拡張可能displayblockに入れ、displaydata構築物は、おそらく全体のスクリプト篩以外の言語の他の実行可能なコンテンツを含む、本明細書で定義することができます。このような材料は、必ずしもこのドキュメントの範囲を超えて独自のセキュリティ上の考慮事項を、持っています。
This section registers a new XML namespace per the procedures in RFC 3688 [RFC3688].
このセクションでは、RFC 3688 [RFC3688]の手順ごとに新しいXML名前空間を登録します。
URI: urn:ietf:params:xml:ns:sieve
URI:URN:IETF:のparams:XML:NS:ふるいです
Registrant Contact: IETF Sieve working group <ietf-mta-filters@imc.org>
登録者連絡先:IETFふるいワーキンググループ<ietf-mta-filters@imc.org>
XML:
XML:
BEGIN <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/> <title>Sieve Namespace</title> </head> <body> <h1>Namespace for Sieve Language objects expressed in XML</h1> <h2>urn:ietf:params:xml:ns:sieve</h2> <p>See <a href="http://www.rfc-editor.org/rfc/rfc5784.txt"> RFC 5784</a>. </p> </body> </html> END
BEGINの<?xml version = "1.0"?> <!DOCTYPE htmlのをPUBLIC! " - // W3C // DTD XHTML Basicの1.0 // EN"「http://www.w3.org/TR/xhtml-basic/xhtml- basic10.dtd "> <HTMLのxmlns =" http://www.w3.org/1999/xhtml "> <HEAD> <META HTTP-当量=" コンテンツタイプ "コンテンツ=" text / htmlの;のcharset =イソ8859-1" /> <タイトル>ふるい名前空間</タイトル> </ head> <body> <H1> XMLで表現さふるい言語のオブジェクトの名前空間</ H1> <H2> URN:IETF:paramsは:XML:NS:ふるい</ H2> <P>は、<a href="http://www.rfc-editor.org/rfc/rfc5784.txt"> RFC 5784 </a>のを参照してください。 </ P> </ body> </ html>このEND
[OASISRNC] Clark, J., "RELAX NG Compact Syntax", OASIS Committee Specification rnc, November 2002.
[OASISRNC]クラーク、J.、2002年11月、OASIS委員会仕様のRNC "NGコンパクト構文をRELAX"。
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC2119]ブラドナーの、S.、 "要件レベルを示すためにRFCsにおける使用のためのキーワード"、BCP 14、RFC 2119、1997年3月。
[RFC3470] Hollenbeck, S., Rose, M., and L. Masinter, "Guidelines for the Use of Extensible Markup Language (XML) within IETF Protocols", BCP 70, RFC 3470, January 2003.
[RFC3470]ホレンベック、S.、ローズ、M.、およびL. Masinter、 "IETFプロトコル内の拡張マークアップ言語(XML)の使用のためのガイドライン"、BCP 70、RFC 3470、2003年1月。
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, January 2004.
[RFC3688] Mealling、M.、 "IETF XMLレジストリ"、BCP 81、RFC 3688、2004年1月。
[RFC5228] Guenther, P. and T. Showalter, "Sieve: An Email Filtering Language", RFC 5228, January 2008.
[RFC5228]ギュンター、P.およびT.ショーウォルター監督、 "ふるい:メールフィルタリング言語"、RFC 5228、2008年1月。
[XML] Bray, T., Paoli, J., Sperberg-McQueen, C., Maler, E., and F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth Edition)", W3C REC-xml-20081126, November 2008, <http://www.w3.org/TR/2008/REC-xml-20081126/>.
[XML]ブレイ、T.、パオリ、J.、Sperberg-マックィーン、C.、MALER、E.、およびF. Yergeau、 "拡張マークアップ言語(XML)1.0(第5版)"、W3C REC-XML-20081126 2008年11月、<http://www.w3.org/TR/2008/REC-xml-20081126/>。
[RFC5183] Freed, N., "Sieve Email Filtering: Environment Extension", RFC 5183, May 2008.
[RFC5183]フリード、N.、 "ふるいのメールフィルタリング:環境拡張"、RFC 5183、2008年5月。
[RFC5229] Homme, K., "Sieve Email Filtering: Variables Extension", RFC 5229, January 2008.
[RFC5229]オム、K.、 "ふるいメールフィルタリング:変数の拡張"、RFC 5229、2008年1月。
[RFC5230] Showalter, T. and N. Freed, "Sieve Email Filtering: Vacation Extension", RFC 5230, January 2008.
[RFC5230]ショーウォルター監督、T.およびN.フリード、 "ふるいメールフィルタリング:休暇延長"、RFC 5230、2008年1月。
[RFC5231] Segmuller, W. and B. Leiba, "Sieve Email Filtering: Relational Extension", RFC 5231, January 2008.
[RFC5231] Segmuller、W.及びB. Leiba、 "ふるいメールフィルタリング:リレーショナル拡張"、RFC 5231、2008年1月。
[RFC5232] Melnikov, A., "Sieve Email Filtering: Imap4flags Extension", RFC 5232, January 2008.
[RFC5232]メルニコフ、A.、 "ふるいのメールフィルタリング:Imap4flags拡張"、RFC 5232、2008年1月。
[RFC5233] Murchison, K., "Sieve Email Filtering: Subaddress Extension", RFC 5233, January 2008.
[RFC5233]マーチソン、K.、 "ふるいメールフィルタリング:サブアドレス拡張"、RFC 5233、2008年1月。
[RFC5235] Daboo, C., "Sieve Email Filtering: Spamtest and Virustest Extensions", RFC 5235, January 2008.
[RFC5235] Daboo、C.、 "ふるいメールフィルタリング:はspamtestとVirustest拡張機能"、RFC 5235、2008年1月。
[RFC5293] Degener, J. and P. Guenther, "Sieve Email Filtering: Editheader Extension", RFC 5293, August 2008.
[RFC5293] Degener、J.とP.ギュンター、 "ふるいメールフィルタリング:Editheader拡張"、RFC 5293、2008年8月。
[RFC5703] Hansen, T. and C. Daboo, "Sieve Email Filtering: MIME Part Tests, Iteration, Extraction, Replacement, and Enclosure", RFC 5703, October 2009.
[RFC5703]ハンセン、T.とC. Daboo、 "ふるいメールフィルタリング:MIMEパートのテスト、反復、抽出、置換、およびエンクロージャ"、RFC 5703、2009年10月。
Appendix A. Extended Example
付録A.拡張の例
The example Sieve script given in Section 9 of [RFC5228] would be represented in XML as the following code component:
[RFC5228]のセクション9で与えられた例Sieveスクリプトは、次のコード成分としてXMLで表現されることになります。
<sieve xmlns="urn:ietf:params:xml:ns:sieve"> <comment> Example Sieve Filter Declare any optional features or extensions used by the script </comment>
<ふるいのxmlns = "壷:IETF:のparams:XML:NS:ふるい"> <コメント>例Sieveフィルタは、スクリプトによって使用される任意のオプション機能や拡張を宣言します。</コメント>
<control name="require"> <str>fileinto</str> </control> <comment> Handle messages from known mailing lists. Move messages from IETF filter discussion list to filter mailbox. </comment> <control name="if"> <test name="header"> <tag>is</tag> <str>Sender</str> <str>owner-ietf-mta-filters@imc.org</str> </test> <action name="fileinto"> <str>filter</str> </action> <postamble> <comment>move to "filter" mailbox</comment> </postamble> </control>
<コントロール名= "必要"> <STR>のfileinto </ STR> </制御> <コメント>知られているメーリングリストからのメッセージを処理します。メールボックスをフィルタリングするIETFフィルタディスカッションリストからのメッセージを移動します。 </コメント> <コントロール名= "IF"> <テスト名= "ヘッダ"> <タグ>である</タグ> <STR>センダ</ STR> <STR> owner-ietf-mta-filters@imc.org </ STR> </テスト> <アクション名= "のfileinto"> <STR>フィルタ</ STR> </アクション> <ポストアンブル> <コメント> "フィルタ" への移行のメールボックス</コメント> </ポストアンブル> </コントロール>
<comment> Keep all messages to or from people in my company. </comment> <control name="elsif"> <test name="address"> <tag>domain</tag> <tag>is</tag> <list> <str>From</str> <str>To</str> </list> <str>example.com</str> </test> <action name="keep"/> </control>
<コメント>または私の会社の人たちからのすべてのメッセージを保管してください。 </コメント> <コントロール名= "ELSIF"> <テスト名= "アドレス"> <タグ>ドメイン</タグ> <タグ>である</タグ> <リスト> <STR>から</ STR> <STR> </ STR> </リスト> <STR> example.com </ STR> </テスト> <アクション名= "続ける" /> </制御>へ
<comment> Try and catch unsolicited email. If a message is not to me, or it contains a subject known to be spam, file it away. </comment> <control name="elsif"> <test name="anyof"> <test name="not"> <test name="address"> <tag>all</tag> <tag>contains</tag> <list> <str>To</str> <str>Cc</str> <str>Bcc</str> </list> <str>me@example.com</str> </test> </test> <test name="header"> <tag>matches</tag> <str>subject</str> <list> <str>*make*money*fast*</str> <str>*university*dipl*mas*</str> </list> </test> </test> <action name="fileinto"> <str>spam</str> </action> </control> <control name="else"> <preamble> <comment> Move all other (non-company) mail to "personal" mailbox. </comment> </preamble> <action name="fileinto"> <str>personal</str> </action> </control>
<コメント>試してみて、迷惑メールをキャッチ。メッセージは私にはない、またはそれがスパムであると知られている対象が含まれている場合は、それを離れてファイル。 </コメント> <コントロール名= "ELSIF"> <テスト名= "anyof"> <テスト名= "ない"> <テスト名= "アドレス"> <タグ>すべての</タグ> <タグ>含まれてい</タグ> <リスト> <STR>から</ STR> <STR> Ccの</ STR> <STR>のBcc </ STR> </リスト> <STR> me@example.com </ STR> </テスト> < /テスト> <テスト名= "ヘッダー"> <タグ>と一致する</タグ> <STR>件名</ STR> <リスト> <STR> *作る*お金*速い* </ STR> <STR> *大学* DIPL * MAS * </ STR> </リスト> </テスト> </テスト> <アクション名= "のfileinto"> <STR>スパム</ STR> </アクション> </制御> <コントロール名= "他「> <前文> <コメント>他のすべての(非会社)のメールを移動するために 『個人』のメールボックス。 </コメント> </プリアンブル> <アクション名= "のfileinto"> <STR>個人</ STR> </アクション> </制御>
</sieve>
</ふるいです>
The same script could be annotated with graphical display hints in a variety of ways. Three possible code components that do this are:
同じスクリプトは、さまざまな方法でグラフィック表示ヒントで注釈を付けることができます。これを行う三つの可能なコードコンポーネントは次のとおりです。
<sieve xmlns="urn:ietf:params:xml:ns:sieve">
<ふるいのxmlns = "URN:IETF:paramsは:XML:NS:ふるいです">
<control name="require"> <str>fileinto</str> </control>
<コントロール名= "必要"> <STR>のfileinto </ STR> </制御>
<displayblock name="File filter list mail" order="1" group="FILE_TO_FOLDER" enable="true"> <control name="if"> <test name="header"> <tag>is</tag> <str>Sender</str> <str>owner-ietf-mta-filters@imc.org</str> </test> <action name="fileinto"> <str>filter</str> </action> </control> </displayblock>
<displayblock名= "ファイルフィルタリストメール" 順= "1" 基は= "FILE_TO_FOLDER" イネーブル= "真"> <コントロール名= "IF"> <テスト名= "ヘッダ"> <タグ>である</タグ> <STR>センダ</ STR> <STR> owner-ietf-mta-filters@imc.org </ STR> </試験> <アクション名= "のfileinto"> <STR>フィルタ</ STR> </アクション> </制御> </ displayblock>
<displayblock name="Keep all company mail" order="2" group="KEEP_MESSAGE" enable="true"> <control name="elsif"> <test name="address"> <tag>domain</tag> <tag>is</tag> <list> <str>From</str> <str>To</str> </list> <str>example.com</str> </test> <action name="keep"/> </control> </displayblock>
<displayblock名= "キープ会社のすべてのメール" オーダー= "2" グループ= "KEEP_MESSAGE" 有効= "真の"> <コントロール名= "ELSIF"> <テスト名= "アドレス"> <タグ>ドメイン</タグ> <タグ>である</タグ> <リスト> <STR>から</ STR> <STR>から</ STR> </リスト> <STR> example.com </ STR> </テスト> <アクション名=」 "/> </制御を維持> </ displayblock>
<displayblock name="File suspected spam" order="3" group="FILE_TO_FOLDER" enable="true"> <control name="elsif"> <test name="anyof"> <test name="not"> <test name="address"> <tag>all</tag> <tag>contains</tag> <list>
<displayblock名= "ファイルの疑いがあるスパム" の順序= "3" グループ= "FILE_TO_FOLDER" 有効= "真の"> <コントロール名= "ELSIF"> <テスト名は= "anyof"> <テスト名= "ありません"> <テスト名= "アドレス"> <タグ>すべての</タグ> <タグ>が</タグ> <リストが含まれています>
<str>To</str> <str>Cc</str> <str>Bcc</str> </list> <str>me@example.com</str> </test> </test> <test name="header"> <tag>matches</tag> <str>subject</str> <list> <str>*make*money*fast*</str> <str>*university*dipl*mas*</str> </list> </test> </test> <action name="fileinto"> <str>spam</str> </action> </control> </displayblock>
<STR>から</ STR> <STR> Ccの</ STR> <STR>のBcc </ STR> </リスト> <STR> me@example.com </ STR> </試験> </試験> <試験名= "ヘッダー"> <タグ>と一致する</タグ> <STR>件名</ STR> <リスト> <STR> *作る*お金*速い* </ STR> <STR> *大学* DIPL * MAS * < / STR> </リスト> </テスト> </テスト> <アクション名= "のfileinto"> <STR>スパム</ STR> </アクション> </制御> </ displayblock>
<displayblock name="File noncompany mail as personal" order="4" group="FILE_TO_FOLDER" enable="true"> <control name="else"> <action name="fileinto"> <str>personal</str> </action> </control> </displayblock>
<displayblock名=オーダー= "4" グループ= "FILE_TO_FOLDER" 有効= "true" を "個人としてnoncompanyメールファイル"> <コントロール名= "他"> <アクション名= "のfileinto"> <STR>個人</ STR > </アクション> </制御> </ displayblock>
</sieve>
</ふるいです>
Note that since displayblock elements are semantically null as far as the script itself is concerned, they can be used to group structures like elsif and else that are tied to statements in other groups.
displayblock要素は限りスクリプト自体に関しては、意味的にはnullであるため、彼らは他のグループ内のステートメントに関連付けられている他のELSIFなどグループ構造に使用できることに注意してください。
The representation of this script in regular Sieve syntax uses structured comments:
通常のふるい構文で、このスクリプトの表現は、構造化されたコメントを使用しています。
require "fileinto"; /* [* name="File filter list mail" order="1" group="FILE_TO_FOLDER" enable="true" */ if header :is "Sender" "owner-ietf-mta-filters@imc.org" { fileinto "filter"; } /* *] */ /* [* name="Keep all company mail" order="2" group="KEEP_MESSAGE" enable="true" */ elsif address :domain :is [ "From", "To" ] "example.com" { keep; } /* *] */ /* [* name="File suspected spam" order="3" group="FILE_TO_FOLDER" enable="true" */ elsif anyof ( not ( address :all :contains [ "To", "Cc", "Bcc" ] "me@example.com" ), header :matches "subject" [ "*make*money*fast*", "*university*dipl*mas*" ] ) { fileinto "spam"; } /* *] */ /* [* name="File noncompany mail as personal" order="4" group="FILE_TO_FOLDER" enable="true" */ else { fileinto "personal"; } /* *] */
A separate namespace can be used to embed text or structured information:
別の名前空間には、テキストや構造化された情報を埋め込むために使用することができます。
<sieve xmlns="urn:ietf:params:xml:ns:sieve" xmlns:nls="http://example.com/nls">
<ふるいのxmlns = "URN:IETF:paramsは:XML:NS:ふるい" のxmlns:NLS = "http://example.com/nls">
<nls:interpretation> If the email header "Sender" is owner-ietf-mta-filters@imc.org, then file it into the "filter" folder.
<NLS:通訳>電子メールのヘッダー「送信者」はowner-ietf-mta-filters@imc.orgである場合には、「フィルタ」フォルダにそれを提出。
Otherwise, if the address in the "From" or "To" has a domain that is "example.com", then keep it.
それ以外の場合は、「差出人」のアドレスまたは「example.com」でドメインを持って、それを維持「するには」場合。
Otherwise, messages meeting with any of these conditions:
それ以外の場合は、メッセージがこれらの条件のいずれかを満たします:
(1) None of the addresses in "To", "Cc", or "Bcc" contain the domain "example.com".
(1)「へ」、「CC」のアドレスのなし、または「BCCが」ドメインが含まれている「example.com」を。
(2) The "Subject" field matches the pattern *make*money*fast* or *university*dipl*mas*, then file it into the "spam" folder.
(2)「件名」フィールドは、*します*お金*速い*またはパターンに一致する*大学* DIPL * MAS *、その後、「迷惑メール」フォルダにそれを提出。
If all else fails, then file the message in the "personal" folder. </nls:interpretation>
他のすべてが失敗した場合は、「個人」フォルダ内のメッセージを提出。 </ NLS:通訳>
... the actual Sieve script ...
...実際のSieveスクリプト...
</sieve>
</ふるいです>
Alternately, displaydata elements can be used to accomplish the same thing:
代わりに、displaydata要素は、同じことを達成するために使用することができます。
<sieve xmlns="urn:ietf:params:xml:ns:sieve">
<ふるいのxmlns = "URN:IETF:paramsは:XML:NS:ふるいです">
<displaydata> <nls-interpretation> If the email header "Sender" is owner-ietf-mta-filters@imc.org, then file it into the "filter" folder.
<displaydata> <NLS-解釈>電子メールのヘッダー「送信者」はowner-ietf-mta-filters@imc.orgである場合には、「フィルタ」フォルダにそれを提出。
Otherwise, if the address in the "From" or "To" has a domain that is "example.com", then keep it.
Otherwise, messages meeting with any of these conditions:
それ以外の場合は、メッセージがこれらの条件のいずれかを満たします:
(1) None of the addresses in "To","Cc", or "Bcc" contain the domain "example.com".
(1)「へ」、「CC」のアドレスのなし、または「BCCが」ドメインが含まれている「example.com」を。
(2) The "Subject" field matches the pattern *make*money*fast* or *university*dipl*mas*, then file it into the "spam" folder.
(2)「件名」フィールドは、*します*お金*速い*またはパターンに一致する*大学* DIPL * MAS *、その後、「迷惑メール」フォルダにそれを提出。
If all else fails, then file the message in the "personal" folder. </nls-interpretation> </displaydata>
他のすべてが失敗した場合は、「個人」フォルダ内のメッセージを提出。 </ NLS-解釈> </ displaydata>
... the actual Sieve script ...
...実際のSieveスクリプト...
</sieve>
</ふるいです>
Again, structured comments are used to represent this in regular Sieve syntax:
ここでも、構造化されたコメントは、通常のふるい構文でこれを表現するために使用されています。
/* [| <nls-interpretation> If the email header "Sender" is owner-ietf-mta-filters@imc.org, then file it into the "filter" folder.
Otherwise, if the address in the "From" or "To" has a domain that is "example.com", then keep it.
Otherwise, messages meeting with any of these conditions:
それ以外の場合は、メッセージがこれらの条件のいずれかを満たします:
(1) None of the addresses in "To","Cc", or "Bcc" contain the domain "example.com".
(1)「へ」、「CC」のアドレスのなし、または「BCCが」ドメインが含まれている「example.com」を。
(2) The "Subject" field matches the pattern *make*money*fast* or *university*dipl*mas*, then file it into the "spam" folder.
(2)「件名」フィールドは、*します*お金*速い*またはパターンに一致する*大学* DIPL * MAS *、その後、「迷惑メール」フォルダにそれを提出。
If all else fails, then file the message in the "personal" folder. </nls-interpretation> |] */
他のすべてが失敗した場合は、「個人」フォルダ内のメッセージを提出。 </ NLS-解釈> |] * /
... the actual Sieve script ...
...実際のSieveスクリプト...
Appendix B. XML Schema for Sieves in XML
XMLでふるい付録B. XMLスキーマ
This appendix is informative. The following code component is an XML Schema for the XML representation of Sieve scripts. Most of the elements employing a complex content model allow use of elements in other namespaces, subject to lax XML Schema validation rules. Additionally, displaydata elements can be used to encapsulate arbitrary XML content. Finally, displayblock elements can be used as a general-purpose grouping mechanism -- arbitrary attributes are allowed on displayblock elements.
この付録は有益です。次のコードコンポーネントは、SieveスクリプトのXML表現のXMLスキーマです。複雑なコンテンツモデルを採用した要素の大半は、ずさんなXMLスキーマ検証ルールに従う他の名前空間の要素の使用を可能にします。また、displaydata要素は、任意のXMLコンテンツをカプセル化するために使用することができます。最後に、displayblock要素は、汎用グループ化メカニズムとして使用することができる - 任意の属性はdisplayblock要素で許可されています。
<?xml version="1.0" encoding="UTF-8"?>
<?xml version = "1.0" エンコード= "UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:sieve" targetNamespace="urn:ietf:params:xml:ns:sieve">
<XSD:スキーマのxmlns:のxsd = "http://www.w3.org/2001/XMLSchema" のxmlns = "URN:IETF:paramsは:XML:NS:篩" のtargetNamespace = "URN:IETF:paramsは:XML:NS :ふるいです ">
<xsd:element name="sieve"> <xsd:complexType> <xsd:sequence> <xsd:choice maxOccurs="unbounded" minOccurs="0">
ます。<xsd:要素名= "ふるい"> <のxsd:complexTypeの> <のxsd:sequence>を<のxsd:選択肢のmaxOccurs = "無制限" のminOccurs = "0">
<xsd:element ref="control"/> <xsd:element ref="action"/> <xsd:element ref="displayblock"/> <xsd:element ref="displaydata"/> <xsd:element ref="comment"/> <xsd:any namespace="##other" processContents="lax"/> </xsd:choice> </xsd:sequence> </xsd:complexType> </xsd:element>
<XSD:要素REF = "コントロール" /> <XSD:要素REF = "アクション" /> <XSD:要素REF = "displayblock" /> <XSD:要素REF = "displaydata" /> <XSD:要素REF = "コメント" /> <XSD:任意の名前空間= "##他" のprocessContents = "緩い" /> </のxsd:選択> </のxsd:sequence>を</のxsd:complexTypeの> </のxsd:element>の
<xsd:element name="comment" type="xsd:string"/>
ます。<xsd:要素名= "コメント" タイプ= "のxsd:文字列" />
<xsd:complexType name="ambles"> <xsd:choice minOccurs="0" maxOccurs="unbounded"> <xsd:element ref="displaydata"/> <xsd:element ref="comment"/> <xsd:any namespace="##other" processContents="lax"/> </xsd:choice> </xsd:complexType>
<XSD:complexTypeの名前= "アンブル"> <のxsd:選択肢のminOccurs = "0" のmaxOccurs = "無制限"> <XSD:要素REF = "displaydata" /> <XSD:要素REF = "コメント" /> <XSD:任意の名前空間= "##他" のprocessContents = "緩い" /> </のxsd:選択> </のxsd:complexTypeの>
<xsd:element name="preamble" type="ambles"/> <xsd:element name="postamble" type="ambles"/>
<XSD:要素名= "プリアンブル" タイプ= "アンブル" /> <XSD:要素名= "ポストアンブル" タイプ= "アンブル" />
<xsd:complexType name="command"> <xsd:sequence> <xsd:element ref="preamble" minOccurs="0" maxOccurs="1"/> <xsd:choice minOccurs="0" maxOccurs="unbounded"> <xsd:element ref="str"/> <xsd:element ref="num"/> <xsd:element ref="list"/> <xsd:element ref="tag"/> </xsd:choice> <xsd:element ref="test" minOccurs="0" maxOccurs="1"/> <xsd:choice minOccurs="0" maxOccurs="unbounded"> <xsd:element ref="control"/> <xsd:element ref="action"/> <xsd:element ref="displayblock"/> </xsd:choice> <xsd:element ref="postamble" minOccurs="0" maxOccurs="1"/> </xsd:sequence> <xsd:attribute use="required" name="name" type="identifier"/> </xsd:complexType>
<XSD:complexTypeの名= "コマンド"> <XSD:配列> <XSD:要素REF = "プリアンブル" のminOccurs = "0" のmaxOccurs = "1" /> <XSD:選択のminOccurs = "0" のmaxOccurs = "unbounded" を> <のxsd:要素REF = "STR" /> <のxsd:要素REF = "NUM" /> <のxsd:要素REF = "リスト" /> <XSD:要素REF = "タグ" /> </のxsd:選択> <XSD:要素REF = "テスト" のminOccurs = "0" のmaxOccurs = "1" /> <XSD:選択のminOccurs = "0" のmaxOccurs = "無制限"> <XSD:要素REF = "コントロール" /> <XSD :要素REF = "アクション" /> <XSD:要素REF = "displayblock" /> </ XSD:選択> <XSD:要素REF = "ポストアンブル" のminOccurs = "0" のmaxOccurs = "1" /> </ XSD :シーケンス> <XSD:属性使用= "必要" 名前= "名前" タイプ= "識別子" /> </のxsd:complexTypeの>
<xsd:element name="control" type="command"/> <xsd:element name="action" type="command"/>
ます。<xsd:要素名= "コントロール" タイプ= "コマンド" /> <XSD:要素名= "アクション" タイプ= "コマンド" />
<xsd:element name="test">
ます。<xsd:要素名= "テスト">
<xsd:complexType> <xsd:sequence> <xsd:choice minOccurs="0" maxOccurs="unbounded"> <xsd:element ref="str"/> <xsd:element ref="num"/> <xsd:element ref="list"/> <xsd:element ref="tag"/> <xsd:element ref="displaydata"/> <xsd:element ref="comment"/> <xsd:any namespace="##other" processContents="lax"/> </xsd:choice> <xsd:element ref="test" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> <xsd:attribute use="required" name="name" type="identifier"/> </xsd:complexType> </xsd:element>
<XSD:complexTypeの> <のxsd:sequence>を<のxsd:選択肢のminOccurs = "0" のmaxOccurs = "無制限"> <XSD:要素REF = "STR" /> <のxsd:要素REF = "NUM" /> <XSD:要素REF = "リスト" /> <XSD:要素REF = "タグ" /> <XSD:要素REF = "displaydata" /> <XSD:要素REF = "コメント" /> <XSD:任意の名前空間= "##他の "のprocessContents = "緩い"/> </のxsd:選択>ます。<xsd:要素REF = "テスト" のminOccurs = "0" のmaxOccurs = "無制限"/> </のxsd:sequence>を<XSD:属性使用=" 必要"NAME =" 名前」タイプ= "識別子" /> </のxsd:complexTypeの> </ XSD:要素>
<xsd:element name="list"> <xsd:complexType> <xsd:sequence> <xsd:element ref="str" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element>
<XSD:要素名= "リスト"> <のxsd:complexTypeの> <XSD:配列> <XSD:要素REF = "STR" のminOccurs = "1" のmaxOccurs = "無制限" /> </ XSD:配列> </ XSD :complexTypeの> </のxsd:element>の
<xsd:element name="tag" type="identifier"/>
<XSD:要素名= "タグ" タイプ= "識別子" />
<xsd:element name="str" type="xsd:string"/>
ます。<xsd:要素名= "STR" タイプ= "のxsd:文字列" />
<xsd:element name="num" type="xsd:nonNegativeInteger"/>
ます。<xsd:要素名= "NUM" タイプ= "のxsd:NonNegativeIntegerの" />
<xsd:simpleType name="identifier"> <xsd:restriction base="xsd:token"> <xsd:pattern value="[A-Za-z_][A-Za-z0-9_]*"/> </xsd:restriction> </xsd:simpleType>
<XSD:simpleTypeの名前= "識別子"> <XSD:制限ベース= "XSD:トークン"> <XSD:パターン値= "[A-ZA-Z _] [A-ZA-Z0-9 _] *" /> < / XSD:制限> </のxsd:simpleTypeの>
<xsd:element name="displayblock"> <xsd:complexType> <xsd:sequence> <xsd:choice minOccurs="0" maxOccurs="unbounded"> <xsd:element ref="control"/> <xsd:element ref="action"/> <xsd:element ref="displayblock"/> <xsd:element ref="displaydata"/> <xsd:element ref="comment"/>
ます。<xsd:要素名= "displayblock"> <のxsd:complexTypeの> <のxsd:sequence>を<のxsd:選択肢のminOccurs = "0" のmaxOccurs = "無制限"> <XSD:要素REF = "コントロール" /> <のxsd:要素REF = "アクション" /> <XSD:要素REF = "displayblock" /> <XSD:要素REF = "displaydata" /> <のxsd:要素REF = "コメント" />
<xsd:any namespace="##other" processContents="lax"/> </xsd:choice> </xsd:sequence> <xsd:anyAttribute processContents="skip"/> </xsd:complexType> </xsd:element>
<XSD:任意の名前空間= "##他" のprocessContents = "緩い" /> </のxsd:選択> </のxsd:sequence>を含む<xsd:anyAttributeはのprocessContents = "スキップ" /> </のxsd:complexTypeの> </ XSD :要素>
<xsd:element name="displaydata"> <xsd:complexType> <xsd:sequence minOccurs="0" maxOccurs="unbounded"> <xsd:any processContents="skip"/> </xsd:sequence> </xsd:complexType> </xsd:element>
ます。<xsd:要素名= "displaydata"> <のxsd:complexTypeの> <XSD:シーケンスのminOccurs = "0" のmaxOccurs = "無制限"> <のxsd:どんなのprocessContents = / "スキップ"> </のxsd:sequence>を</ XSD :complexTypeの> </のxsd:element>の
</xsd:schema>
</ XSD:スキーマ>
Appendix C. Relax NG Schema for Sieves in XML
付録C. XMLでのふるいのためNGスキーマをリラックス
This appendix is informative. The following code component defines a Relax NG Schema using compact notation OASISRNC [OASISRNC] for the XML representation of Sieve scripts. Most of the elements employing a complex content model allow unrestricted use of elements in other namespaces. Additionally, displaydata elements can be used to encapsulate arbitrary XML content. Finally, displayblock elements can be used as a general-purpose grouping mechanism -- arbitrary attributes are allowed on displayblock elements.
この付録は有益です。次のコードコンポーネントは、SieveスクリプトのXML表現のためのコンパクトな表記OASISRNC [OASISRNC]を使用してNGスキーマリラックス定義します。複雑なコンテンツモデルを採用した要素のほとんどは、他の名前空間の要素の無制限の使用を許可します。また、displaydata要素は、任意のXMLコンテンツをカプセル化するために使用することができます。最後に、displayblock要素は、汎用グループ化メカニズムとして使用することができる - 任意の属性はdisplayblock要素で許可されています。
namespace sieve = "urn:ietf:params:xml:ns:sieve"
名前空間のふるい= "壷:IETF:のparams:XML:NS:ふるいです"
start = element sieve:sieve { ( control | action | displayblock | displaydata | comment | ext )* }
開始=要素のふるい:ふるい{(制御|アクション| displayblock | displaydata |コメント| EXT)*}
comment = element sieve:comment { xsd:string }
コメント=エレメントのふるい:コメント{XSD:文字列}
ambles = ( ( displaydata | comment | ext )* ), empty
アンブル=((displaydata |コメント| EXT)*)、空
preamble = element sieve:preamble { ambles } postamble = element sieve:postamble { ambles }
プリアンブル=エレメント篩プリアンブル{アンブル}ポストアンブル=エレメントのふるい:ポストアンブル{アンブル}
command = ( attribute name { xsd:token {
コマンド=(属性名{のxsd:トークン{
pattern = "[A-Za-z_][A-Za-z0-9_]*" } }, preamble?, ( str | num | \list | tag )*, test?, ( control | action | displayblock)*, postamble? ), empty
パターン= "[A-ZA-Z _] [A-ZA-Z0-9 _] *"}}、プリアンブル?,(STR |番号| \リスト|タグ)*、試験?(制御|アクション| displayblock)* 、ポストアンブル? )、 空の
control = element sieve:control { command } action = element sieve:action { command }
制御=エレメントのふるい:制御コマンド{}アクション=エレメントのふるい:アクション{コマンド}
test = element sieve:test { attribute name { xsd:token { pattern = "[A-Za-z_][A-Za-z0-9_]*" } }, ( str | num | \list | tag | comment | ext )*, test* }
テスト=エレメント篩:テスト{属性名{XSD:トークン{パターン= "[A-ZA-Z _] [A-ZA-Z0-9 _] *"}}、(STR |番号| \リスト|タグ|コメント| EXT)*テスト*}
\list = element sieve:list { str+ }
\リスト=要素のふるい:リスト{STRの+}
tag = element sieve:tag { xsd:token { pattern = "[A-Za-z_][A-Za-z0-9_]*" } }
タグ=エレメントのふるい:タグ{XSD:トークン{パターン= "[A-ZA-Z _] [A-ZA-Z0-9 _] *"}}
str = element sieve:str { xsd:string }
STR =エレメントのふるい:STR {XSD:文字列}
num = element sieve:num { xsd:nonNegativeInteger }
NUM =エレメントのふるい:NUM {XSD:NonNegativeIntegerの}
any = ( element * { any } | attribute * { text } | text )*
任意=(要素* {いかなる} |属性* {テキスト} |テキスト)*
ext = element * - sieve:* { any }*
EXT =エレメント* - ふるい:* {いかなる} *
displayblock = element sieve:displayblock { ( control | action | displayblock | displaydata | comment | ext )*, attribute * { text }* }
displayblock =要素のふるい:displayblock {(制御|アクション| displayblock | displaydata |コメント| EXT)*、属性* {テキスト} *}
displaydata = element sieve:displaydata { any* }
displaydata =エレメントのふるい:displaydata {任意*}
Appendix D. Stylesheet for Conversion from XML
XMLからの変換のための付録D.スタイルシート
This appendix is informative. The following code component is a stylesheet that can be used to convert the Sieve in XML representation to regular Sieve format. Content in other namespaces, displaydata, and displayblock elements are converted to structured comments as appropriate.
この付録は有益です。次のコードコンポーネントは、通常のふるい形式にXML表現のふるいを変換するために使用することができるスタイルシートです。他の名前空間、displaydata、およびdisplayblock要素のコンテンツを適切に構造化されたコメントに変換されます。
<?xml version="1.0" encoding="UTF-8"?>
<?xml version = "1.0" エンコード= "UTF-8"?>
<!-- Convert Sieve in XML to standard Sieve syntax -->
<! - 標準ふるい構文にXMLでふるいを変換します - >
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sieve="urn:ietf:params:xml:ns:sieve">
<XSL:スタイルシートのバージョン= "1.0" のxmlns:XSL = "http://www.w3.org/1999/XSL/Transform" のxmlns:ふるい= "URN:IETF:paramsは:XML:NS:ふるいです">
<xsl:output method="text" encoding="UTF-8" media-type="application/sieve"/>
<のxsl:出力メソッド= "テキスト" エンコード= "UTF-8" メディアタイプ= "アプリケーション/篩" />
<!-- Only preserve whitespace in str elements --> <xsl:strip-space elements="*"/> <xsl:preserve-space elements="sieve:str"/>
<! - のみstrの要素に空白を保持 - > <のxsl:ストリップ空間要素= "*" /> <XSL:保存空間要素= "ふるい:STR" />
<!-- Match top level sieve node, start processing in sieve mode -->
<! - マッチトップレベルふるいノード、ふるいモードの処理を開始します - >
<xsl:template match="sieve:sieve"> <xsl:apply-templates select="*" mode="sieve"> <xsl:with-param name="prefix" select="''"/> </xsl:apply-templates> </xsl:template>
<のxsl:テンプレートマッチ= "ふるい:ふるい"> <のxsl:適用-テンプレートは= "*" モード= "ふるい" を選択> <のxsl:と-PARAM NAME = "接頭辞" を選択= " ''" /> </ XSL:適用-テンプレート> </ XSL:テンプレート>
<!-- Routine to properly literalize quotes in Sieve strings -->
<! - 正しくふるい文字列に引用符をliteralizeするルーチン - >
<xsl:template name="quote-string"> <xsl:param name="str"/> <xsl:choose> <xsl:when test="not($str)"/> <xsl:when test="contains($str, '"')"> <xsl:call-template name="quote-string"> <xsl:with-param name="str" select="substring-before($str, '"')"/> </xsl:call-template> <xsl:text>\"</xsl:text> <xsl:call-template name="quote-string"> <xsl:with-param name="str" select="substring-after($str, '"')"/> </xsl:call-template>
<のxsl:テンプレート名= "引用文字列"> <のxsl:のparamの名前= "STR" /> <のxsl:選択> <のxsl:テスト= "ではない($ strの)" /> <のxsl:テスト=」含まれています($ strの、 '&QUOTを;') "> <のxsl:コールテンプレート名=" 引用文字列は "> <のxsl:で-PARAM NAME =" STR "を選択=" サブ-前に、$ strの(「& QUOT; ') "/> </ XSL:コールテンプレート> <のxsl:テキスト> \&QUOT; </ XSL:テキスト> <のxsl:コールテンプレート名=" 引用文字列 "> <のxsl:と-PARAM名前=選択= "STR" "サブ-後($ strの、 '&QUOT;')" /> </ XSL:コールテンプレート>
</xsl:when> <xsl:when test="contains($str, '\')"> <xsl:call-template name="quote-string"> <xsl:with-param name="str" select="substring-before($str, '\')"/> </xsl:call-template> <xsl:text>\\</xsl:text> <xsl:call-template name="quote-string"> <xsl:with-param name="str" select="substring-after($str, '\')"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$str"/> </xsl:otherwise> </xsl:choose> </xsl:template>
</ XSL:とき> <のxsl:テスト=は "( '\'、$ strの)が含まれている" とき> <のxsl:コールテンプレート名= "引用文字列"> <のxsl:選択して-PARAM NAME = "STR" = "サブ-前($ strの、 '\')" /> </ XSL:コールテンプレート> <のxsl:テキスト> \\ </ XSL:テキスト> <のxsl:コールテンプレート名= "引用文字列" > <XSL:と-PARAM NAME = "STR" =を選択し、 "サブ-後($ strの、 '\')" /> </ XSL:テンプレート呼び出し> </ XSL:とき> <のxsl:それ以外の場合は> <XSL :選択= "$ strの" /> </ XSLの価値:そう> </ XSL:> </ XSL選択:テンプレート>
<!-- Sieve mode processing templates -->
<! - ふるいモード処理テンプレート - >
<xsl:template match="sieve:control|sieve:action" mode="sieve"> <xsl:param name="prefix"/> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:value-of select="@name"/> <xsl:variable name="blockbegin" select="generate-id(sieve:control|sieve:action)"/> <xsl:for-each select="*"> <xsl:choose> <xsl:when test="self::sieve:str|self::sieve:num| self::sieve:list|self::sieve:tag| self::sieve:test"> <xsl:apply-templates select="." mode="sieve"/> </xsl:when> <xsl:when test="generate-id(.) = $blockbegin"> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text>{</xsl:text> <xsl:apply-templates select="." mode="sieve"> <xsl:with-param name="prefix" select="concat($prefix, ' ')"/> </xsl:apply-templates> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="." mode="sieve"> <xsl:with-param name="prefix"
<のxsl:テンプレートの一致= "ふるい:コントロール|ふるい:アクション" モード= "ふるい"> <のxsl:PARAM NAME = "接頭辞" /> <XSL:テキストのxml:スペース= "保存"> </ XSL:テキスト> <のxsl:選択値-の= "$接頭辞" /> <のxsl:選択値-の= "名前@" /> <のxsl:変数名= "blockbegin" を生成-ID(ふるい "=を選択:コントロール|ふるい:アクション) "/> <XSL:用-それぞれが=選択" * "> <のxsl:選択> <のxsl:ときテスト=" 自己::ふるい:STR |自己::ふるい:NUM |自己::ふるい:リスト|自己::ふるい:タグ|自己::ふるい:テスト "> <のxsl:適用-テンプレートは=選択"「。モード= "ふるい" /> </ XSL:場合> <XSL:テスト= "(。)を生成-IDを= $ blockbegin"> <XSL:テキストXML:スペース=> </ XSL "保存":テキスト> < XSL:選択値-の= "$接頭辞" /> <のxsl:テキスト> {</ XSL:テキスト> <のxsl:適用-テンプレート=選択 ""モード= "ふるい"> <のxsl:と-PARAM NAME = "接頭辞" =を選択し、「CONCAT($接頭辞を、 '「) "/> </ XSL:適用-テンプレート> </ XSL:とき> <のxsl:それ以外の場合は> <のxsl:適用-テンプレートは=を選択し、 ""モード= "ふるい"> <のxsl:と-PARAM NAME = "接頭辞"
select="concat($prefix, ' ')"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:for-each> <xsl:choose> <xsl:when test="count(sieve:control|sieve:action) > 0"> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text>}</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>;</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template>
</ XSL = "CONCAT($接頭辞、 '「)" />を選択:適用-テンプレート> </ XSL:そう> </ XSL:> </ XSL選択:のために、各> <のxsl:> <選択のxsl:テスト= "カウント(ふるい:コントロール|ふるい:アクション)&GT; 0"> <のxsl:テキストのxml:スペース=> </ XSL "保存":テキスト> <のxsl:価値の選択= "$接頭辞" /> <XSL:テキスト>} </ XSL:テキスト> </ XSL:場合> <XSL:特に> <XSL:テキスト>; </ XSL:テキスト> </ XSL:特に> </ XSL:選択> < / XSL:テンプレート>
<xsl:template match="sieve:preamble|sieve:postamble" mode="sieve"> <xsl:param name="prefix"/> <xsl:apply-templates mode="sieve"> <xsl:with-param name="prefix" select="$prefix"/> </xsl:apply-templates> </xsl:template>
<のxsl:テンプレートマッチ= "ふるい:プリアンブル|ふるい:ポストアンブル" モード= "ふるい"> <のxsl:のparamの名前= "接頭辞" /> <のxsl:適用-テンプレートモード= "ふるい"> <のxsl:と-PARAM >テンプレート:適用-テンプレート> </ XSL:名= "接頭辞" = "$接頭辞" /> </ XSLを選択
<xsl:template match="sieve:test" mode="sieve"> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="@name"/> <xsl:apply-templates select="*[not(self::sieve:test)]" mode="sieve"/> <xsl:if test="count(descendant::sieve:test) > 0"> <xsl:text> (</xsl:text> <xsl:for-each select="sieve:test"> <xsl:apply-templates select="." mode="sieve"/> <xsl:if test="count(following-sibling::sieve:test) > 0"> <xsl:text>,</xsl:text> </xsl:if> </xsl:for-each> <xsl:text> )</xsl:text> </xsl:if> </xsl:template>
<のxsl:テンプレートの一致= "ふるい:テスト" モード= "ふるい"> <のxsl:テキストのxml:スペース= "保存"> </ XSL:テキスト> <のxsl:選択値-の= "名前@" /> < XSL:適用-テンプレートを選択= "* [しない(自己::ふるい:テスト)]" モード= "ふるい" /> <XSL:もしテスト= "カウント(子孫::ふるい:テスト)&GT; 0"> <XSL:テキスト>(</ XSL:テキスト> <XSL:のために、各=選択 "ふるい:試験"> <XSL:適用-テンプレートは=選択モード= "ふるい" / ""> <XSL:テストする場合= "カウント(以下、兄弟::ふるい:テスト)&GT; 0"> <XSL:テキスト>、</ XSL:テキスト> </ XSL:場合> </ XSL:のために、それぞれ> <XSL:テキスト>) </ XSL:テキスト> </ XSL:もし> </ XSL:テンプレート>
<xsl:template match="sieve:str" mode="sieve"> <xsl:text> "</xsl:text> <xsl:call-template name="quote-string"> <xsl:with-param name="str" select="text()"/> </xsl:call-template> <xsl:text>"</xsl:text>
<のxsl:テンプレートマッチ= "ふるい:STR" モード= "ふるい"> <のxsl:テキスト>&QUOT; </ XSL:テキスト> <のxsl:コールテンプレート名= "引用文字列"> <のxsl:with- paramの名前= "STR" を選択= "テキスト()" /> </ XSL:コールテンプレート> <のxsl:テキスト>&QUOT; </ XSL:テキスト>
</xsl:template>
</ XSL:テンプレート>
<xsl:template match="sieve:num" mode="sieve"> <xsl:text xml:space="preserve"> </xsl:text> <!-- Use numeric suffixes when possible --> <xsl:choose> <xsl:when test="(number(text()) mod 1073741824) = 0"> <xsl:value-of select="number(text()) div 1073741824"/> <xsl:text>G</xsl:text> </xsl:when> <xsl:when test="(number(text()) mod 1048576) = 0"> <xsl:value-of select="number(text()) div 1048576"/> <xsl:text>M</xsl:text> </xsl:when> <xsl:when test="(number(text()) mod 1024) = 0"> <xsl:value-of select="number(text()) div 1024"/> <xsl:text>K</xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="text()"/> </xsl:otherwise> </xsl:choose> </xsl:template>
<のxsl:テンプレートの一致= "ふるい:NUM" モード= "ふるい"> <のxsl:テキストのxml:スペース= "保存"> </ XSL:テキスト> <! - 使用数値サフィックス可能な場合は - > <のxsl:場合テスト= "(番号(テキスト())MOD 1073741824)= 0"> <XSL:価値の選択= "番号(テキスト())DIV 1073741824" /> <XSL:> <XSL選択テキスト> G < / XSL:テキスト> </ XSL:> <XSL:選択値-の= "数(テキスト())DIV 1048576":テスト=> <XSL "(1048576番号(テキスト())MOD)が0 =" /> <XSL:テキスト> M </ XSL:テキスト> </ XSL:場合> <XSL:ときにテスト= "(番号(テキスト())MOD 1024)= 0"> <XSL:選択値-の=」番号(テキスト())DIV 1024 "/> <XSL:テキスト> K </ XSL:テキスト> </ XSL:場合> <XSL:特に> <XSL:価値の選択=" テキスト() "/> < / XSL:そう> </ XSL:選択> </ XSL:テンプレート>
<xsl:template match="sieve:list" mode="sieve"> <xsl:text> [</xsl:text> <xsl:for-each select="sieve:str"> <xsl:apply-templates select="." mode="sieve"/> <xsl:if test="count(following-sibling::sieve:str) > 0"> <xsl:text>,</xsl:text> </xsl:if> </xsl:for-each> <xsl:text> ]</xsl:text> </xsl:template>
<のxsl:テンプレートマッチ= "ふるい:リスト" モード= "ふるい"> <のxsl:テキスト> [</ XSL:テキスト> <のxsl:のfor-each =を選択し、 "ふるい:STR"> <のxsl:適用-テンプレートを選択します= ""モード= "ふるい" /> <XSL:もしテスト= "カウント(以下、兄弟::ふるい:STR)&GT; 0"> <XSL:テキスト>、</ XSL:テキスト> </ XSL:場合> < / XSL:のために、それぞれ> <XSL:テキスト> </ XSL:テキスト> </ XSL:テンプレート>
<xsl:template match="sieve:tag" mode="sieve"> <xsl:text> :</xsl:text> <xsl:value-of select="text()"/> </xsl:template>
<XSL:テンプレートマッチ= "ふるい:タグ" モード= "ふるい"> <XSL:テキスト>:</ XSL:テキスト> <XSL:価値の選択= "テキスト()" /> </ XSL:テンプレート>
<xsl:template match="sieve:comment" mode="sieve"> <xsl:param name="prefix"/> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text>/*</xsl:text> <xsl:value-of select="."/> <xsl:value-of select="$prefix"/>
<xsl:text>*/</xsl:text> </xsl:template>
<のxsl:テキスト> * / </ XSL:テキスト> </ XSL:テンプレート>
<!-- Convert display information into structured comments -->
<! - 構造化コメントに表示情報を変換します - >
<xsl:template match="sieve:displayblock" mode="sieve"> <xsl:param name="prefix"/> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text>/* [*</xsl:text> <xsl:apply-templates select="@*" mode="copy"/> <xsl:text> */</xsl:text> <xsl:apply-templates select="*" mode="sieve"> <xsl:with-param name="prefix" select="$prefix"/> </xsl:apply-templates> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text>/* *] */</xsl:text> </xsl:template>
<xsl:template match="sieve:displaydata" mode="sieve"> <xsl:param name="prefix"/> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text>/* [|</xsl:text> <xsl:apply-templates mode="copy"> <xsl:with-param name="prefix" select="concat($prefix, ' ')"/> </xsl:apply-templates> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text> |] */</xsl:text> </xsl:template>
<!-- Copy unrecnognized nodes and their descendants -->
<! - コピーunrecnognizedノードとその子孫 - >
<xsl:template match="*" mode="sieve"> <xsl:param name="prefix"/> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text>/* [/</xsl:text> <xsl:apply-templates select="." mode="copy"> <xsl:with-param name="prefix"
select="concat($prefix, ' ')"/> </xsl:apply-templates> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text> /] */</xsl:text> </xsl:template>
<XSL>適用され、テンプレート:</ XSL = "CONCAT($接頭辞、 '「) "/>を選択し、テキストのxml:スペース=> </ XSL" 保存 ":テキスト> <のxsl:選択値-の=" $接頭辞 "/> <のxsl:テキスト> /] * / </ XSL:テキスト> </ XSL:テンプレート>
<!-- Copy mode processing templates -->
<! - コピーモード処理テンプレート - >
<xsl:template match="*[not(node())]" mode="copy"> <xsl:param name="prefix"/> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text><</xsl:text> <xsl:value-of select="name()"/> <xsl:apply-templates select="@*" mode="copy"/> <xsl:text>/></xsl:text> </xsl:template>
<のxsl:テンプレートマッチ= "* [ない(ノード())]" モード= "コピー"> <のxsl:PARAM NAME = "接頭辞" /> <XSL:テキストのxml:スペースは= "保存"> </ XSL:テキスト> <のxsl:選択値-の= "$接頭辞" /> <のxsl:テキスト>&LT; </ XSL:テキスト> <のxsl:選択値-の= "名前()" /> <のxsl:apply-テンプレートを選択= "@ *" モード= "コピー" /> <のxsl:テキスト> /&GT; </ XSL:テキスト> </ XSL:テンプレート>
<xsl:template match="*[node()]" mode="copy"> <xsl:param name="prefix"/> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> <xsl:text><</xsl:text> <xsl:value-of select="name()"/> <xsl:apply-templates select="@*" mode="copy"/> <xsl:text>></xsl:text> <xsl:apply-templates mode="copy"> <xsl:with-param name="prefix" select="concat($prefix, ' ')"/> </xsl:apply-templates> <xsl:if test="*[last()][not(text())]"> <xsl:text xml:space="preserve"> </xsl:text> <xsl:value-of select="$prefix"/> </xsl:if> <xsl:text></</xsl:text> <xsl:value-of select="name()"/> <xsl:text>></xsl:text> </xsl:template>
<のxsl:テンプレートマッチ= "* [ノード()]" モード= "コピー"> <のxsl:のparamの名前= "接頭辞" /> <XSL:テキストのxml:スペース= "保存"> </ XSL:テキスト> < XSL:価値の選択= "$接頭辞" /> <のxsl:テキスト>&LT; </ XSL:テキスト> <のxsl:選択値-の= "名前()" /> <のxsl:適用-テンプレートを選択= "@ *" モード= "コピー" /> <のxsl:テキスト>&GT; </ XSL:テキスト> <のxsl:適用-テンプレートモード= "コピー"> <のxsl:と-paramは名前= "接頭辞" を選択= 「CONCAT($接頭辞、 '「) "/> </ XSL:適用-テンプレート> <のxsl:もしテスト=" * [最後の()] [ない(テキスト())] "> <のxsl:テキストのxml:スペース= "保存"> </ XSL:テキスト> <のxsl:選択= "$接頭辞"-の値/> </ XSL:もし> <のxsl:テキスト>&LT; / </ XSL:テキスト> <のxsl:値選択-of = "名前()" /> <XSL:テキスト>&GT; </ XSL:テキスト> </ XSL:テンプレート>
<xsl:template match="@*" mode="copy"> <xsl:text> </xsl:text> <xsl:value-of select="name()"/> <xsl:text>="</xsl:text>
<のxsl:テンプレートの一致= "@ *" モード= "コピー"> <のxsl:テキスト> </ XSL:テキスト> <のxsl:選択値-の= "名前()" /> <のxsl:テキスト> = "< / XSL:テキスト>
<xsl:value-of select="."/> <xsl:text>"</xsl:text> </xsl:template>
<のxsl:価値の選択= /」。 "> <のxsl:テキスト>" </ XSL:テキスト> </ XSL:テンプレート>
</xsl:stylesheet>
</ XSL:スタイルシート>
Appendix E. Acknowledgements
付録E.謝辞
The stylesheet copy mode code is loosely based on a sample code posted to the xsl-list list by Americo Albuquerque. Jari Arkko, Robert Burrell Donkin, Andrew McKeon, Alexey Melnikov, and Aaron Stone provided useful comments on the document.
スタイルシートのコピーモードのコードは緩くAmericoアルバカーキでXSL-リストリストに掲載のサンプルコードに基づいています。ヤリArkko、ロバート・バレルDonkinに、アンドリュー・マッキオン、アレクセイ・メルニコフ、とアーロン・ストーンは、ドキュメント上の有益なコメントを提供しました。
Authors' Addresses
著者のアドレス
Ned Freed Sun Microsystems 800 Royal Oaks Monrovia, CA 91016-6347 USA
ネッドフリードSun Microsystemsの800ロイヤルオークスモンロビア、カリフォルニア州91016から6347 USA
Phone: +1 909 457 4293 EMail: ned.freed@mrochek.com
電話:+1 909 457 4293 Eメール:ned.freed@mrochek.com
Srinivas Saisatish Vedam Sun Microsystems
スリニバスSaisatish Vedamサン・マイクロシステムズ
Phone: +91 80669 27577 EMail: Srinivas.Sv@Sun.COM
電話:+91 80669 27577 Eメール:Srinivas.Sv@Sun.COM