ヘッダーをスキップ
Oracle® Oracle Fusion Middleware Oracle WebCenter Contentのマネージング
11g リリース1(11.1.1)
B72426-01
  ドキュメント・ライブラリへ移動
ライブラリ
目次へ移動
目次

前
 
次
 

42 Elementsスクリプト・テンプレート

この章では、Dynamic ConverterのElementsスクリプト・テンプレートとコードについて説明します。

この章の内容は、次のとおりです。

42.1 Elementsスクリプト・テンプレートについて

Elementスクリプト・テンプレートは、ソース・ファイルのすべての要素を個別に定義します。

このテンプレートは、他のテンプレートによって呼び出されることはなく、単純にソース・ファイルのすべての要素を分割する役割を果たします。

42.2 Elementsスクリプト・テンプレート・コード

この項では、各コード・セグメント(太字)の後にそれを説明するテキストが続きます。

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset={## INSERT ELEMENT=pragma.charset}">
{## IF ELEMENT=Property.Title}
   <TITLE>{## INSERT ELEMENT=Property.Title}</TITLE>
{## ELSE}
<TITLE>Converted {## INSERT ELEMENT=Pragma.SourceFileName}</TITLE>
{## /IF}

このドキュメントにタイトル・プロパティが存在する場合、それをHTMLタイトルに挿入します。存在しない場合、ドキュメントの名前をHTMLタイトルに挿入します。

</head>

<body bgcolor="#FFFFFF">
<div align="left">

<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
   <tr>
      <td><font size="7">Dynamic Converter</font><br>
        <font color="#FFFFFF" size="5">Sample Template – All Elements</font>
      </td>
   </tr>
</table>
</div>

出力ページの先頭の表、表内のテキスト(Dynamic Converter Sample Template – All Elements)、およびこのテキストのフォントの色とサイズを定義します。

<p>&nbsp;</p>
<div align="left">

<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
      <tr>
        <td><font color="#FFFFFF" size="5">Standard Properties</font></td>
      </tr>
</table>
</div>

出力ページの2番目の表を定義します。

<p><strong>Author: </strong>
{## INSERT ELEMENT=Property.Author}<br>
<strong>Title: </strong>
{## INSERT ELEMENT=Property.Title}<br>
<strong>Subject: </strong>
{## INSERT ELEMENT=Property.Subject}<br>
<strong>Keywords: </strong>
{## INSERT ELEMENT=Property.Keywords}<br>
<strong>Comment:</strong>
{## INSERT ELEMENT=Property.Comment}</p>

これらの## Insertマクロは、エクスポートされるソース・ファイルの作成者が記述したとおりに、ソース・ファイルの個々のプロパティ(Author、Title、Subject、Keywords、Comments)を挿入します。

<div align="left">

<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
   <tr>
      <td><font color="#FFFFFF" size="5">Other Properties</font></td>
   </tr>
</table>
</div>

出力ページの3番目の表を定義します。

<p>{## REPEAT ELEMENT=Property.Others}
<strong>
{## INSERT
ELEMENT=Property.Others.Current.Name}: </strong>
{## INSERT ELEMENT=Property.Others.Current.Body}<br>
{## /REPEAT}</p>

エクスポートされるソース・ファイルの他のプロパティの名前と本体を、ソース・ファイルの作成者が定義したとおりに挿入します。NameプロパティとBodyプロパティは、初期プロパティ(Author、Title、Subject、Keywords、Comments)とは異なる方法で参照します。ソース・ファイルの作成者は初期プロパティのキーワードを使用しない固有プロパティを作成できます。前述の## REPEATマクロを使用すると、そのような固有プロパティを読み取ることができます。それには、ソース・ファイルの固有プロパティをループ処理しながら、その名前要素と本体要素の両方を参照して出力します。

<p>{## REPEAT ELEMENT=Sections}</p>

反復可能要素Sectionsに対するループは、ソース・ファイル内の最高レベルの抽象を表します。この反復可能要素を使用すると、たとえば3つのシートからなるスプレッドシートをループ処理して、各シートを出力に表示できます。1つのセクションの各部分を出力するには、すべてのセクションをループ処理する必要があります。一般には、次のようになります。

<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
    <td><font color="#FFFFFF" size="5">Section
{## INSERT NUMBER=Sections.Current.Value}
The fourth table of the output page is defined and the index value that is inserted into the table is incremented once through each loop.

{## IF ELEMENT=Sections.Current.Type VALUE=WP}
- Document
{## ELSE}
{## IF ELEMENT=Sections.Current.Title} - {## INSERT ELEMENT=Sections.Current.Title
      SUPPRESSTAGS}
{## /IF}

{## /IF}

</font>
</td>

テンプレートは、ソース・ファイルがワード・プロセッシング(WP)かどうかを判断し、次を実行します。

</tr>
</table>
</div>

<p>
{## INSERT ELEMENT=Sections.Current.BodyOrImage}</p>

このマクロ行を使用すると、テンプレート作成者が任意のドキュメント・タイプを処理できます。「要素」の項でSections.x.BodyOrImageを参照してください。

<p>
{## IF ELEMENT=Sections.Current.Type VALUE=WP}
</p>
<p>
{## IF ELEMENT=Sections.Current.Footnotes.1.Body}
</p>
<div align="left">
<table border="0" cellpadding="2"width="600" bgcolor="#8080FF">
<tr>
  <td><font color="#FFFFFF" size="5">Footnotes</font>
</td>
</tr>
</table>

テンプレートは、まずセクション・タイプがワード・プロセッシングかどうか、次にこのセクションに脚注が存在するかどうかを判断します。脚注が存在する場合、脚注の始まりを示すFootnotesを出力する表を定義します。

</div>
<p>
{## REPEAT ELEMENT=Sections.Current.Footnotes}
{## INSERT ELEMENT=Sections.Current.Footnotes.Current.Body}
<br>
{## /REPEAT}
{## ELSE}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">No Footnotes</font></td>
</tr>
</table>
</div>
<p>
{## /IF}

</p>

反復可能要素を使用して、現在のセクションに関連付けられているすべての脚注を出力します。現在のセクションに脚注が関連付けられていない場合、脚注が存在しないことを示すNo Footnotesを出力する表を作成します。

このテンプレートの残りのHTMLコードは、直前に説明したFootnotes反復可能要素と同様のコードを使用する要素に関するものです。たとえば、次に示す反復可能要素Endnotesの場合、コードは、脚注の場合と同じ方法でソース・ファイル出力に文末脚注を配置するように機能します。

反復可能要素を使用して、現在のセクションに関連付けられているすべての文末脚注を出力します。

次のHTMLコードと生成される出力では、注釈、コメント、ヘッダー、フッターおよびブックマークで同じ手順を実行しています。

<p>
{## IF ELEMENT=Sections.Current.Endnotes.1.Body}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">Endnotes</font></td>
</tr>
</table>
</div>
<p>
{## REPEAT ELEMENT=Sections.Current.Endnotes}
{## INSERT ELEMENT=Sections.Current.Endnotes.Current.Body}<br>
{## /REPEAT}

{## ELSE}
</p>
<div align="left"><table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF"
size="5">No Endnotes</font></td>
</tr>
</table>
</div>
<p>
{## /IF}

</p>
<p>
{## IF ELEMENT=Sections.Current.Annotations.1.Body}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
    <td><fontcolor="#FFFFFF" size="5">Annotations</font></td>
</tr>
</table>
</div>
<p>
{## REPEAT ELEMENT=Sections.Current.Annotations}
   {## INSERT ELEMENT=Sections.Current.Annotations.Current.
Body}<br>
{## /REPEAT}

{## ELSE}
</p>
   <div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">No Annotations</font></td>
</tr>
</table>
</div>
<p>
{## /IF}

</p>
<p>

{## IFELEMENT=Sections.Current.Headers.1.Body}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">Headers</font></td>
</tr>
</table>
</div>
<p>
{## REPEAT ELEMENT=Sections.Current.Headers}
{## INSERT ELEMENT=Sections.Current.Headers.Current.Body} <br>
    {## /REP}

{## ELSE}
</p>
<div align="left"><table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">No Headers</font></td>
</tr>
</table>
</div>
<p>
{## /IF}

</p>
<p>
{## IF ELEMENT=Sections.Current.Footers.1.Body}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">Footers</font></td>
</tr>
</table>
</div>
<p>
{## REPEAT ELEMENT=Sections.Current.Footers}
{## INSERT ELEMENT=Sections.Current.Footers.
Current. Body}<br>
{## /REP}

{## ELSE}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">No Footers</font></td>
</tr>
</table>
</div>
<p>
{## /IF}

</p>
<p>
{## /IF}

</p>
<p>
{## /REPEAT}

</p>
</body>
</html>