summaryrefslogtreecommitdiff
path: root/helpcontent2/source/text/shared/guide/xsltfilter.xhp
blob: af0e54d32bd7a90c173ea1bcb2c2f15ff33ec3fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************************
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************-->
	
<helpdocument version="1.0">
<meta>
<topic id="textsharedguidexsltfilterxml" indexer="include" status="PUBLISH">
<title id="tit" xml-lang="en-US">Working With %PRODUCTNAME XML Filters </title>
<filename>/text/shared/guide/xsltfilter.xhp</filename>
</topic>
<history>
<created date="2004-05-18T13:56:11">see also ui.openoffice.org/proposals/XMLFilterSpec.sxw</created>
<lastedited date="2005-09-26T15:00:23">dedr: reviewed</lastedited>
</history>
</meta>
<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id7007583"><bookmark_value>file filters;XML</bookmark_value>
<bookmark_value>saving;to XML</bookmark_value>
<bookmark_value>loading;from XML</bookmark_value>
<bookmark_value>importing;from XML</bookmark_value>
<bookmark_value>exporting;to XML</bookmark_value>
<bookmark_value>XSLT filters, see also XML filters</bookmark_value>
<bookmark_value>distributing; XML filters</bookmark_value>
<bookmark_value>deleting;XML filters</bookmark_value>
<bookmark_value>testing;XML filters</bookmark_value>
<bookmark_value>XML filters;creating/testing/distributing/deleting</bookmark_value>
</bookmark>
<paragraph role="heading" id="par_idN1052D" xml-lang="en-US" level="1" l10n="NEW"><variable id="xsltfilter"><link href="text/shared/guide/xsltfilter.xhp">Working With %PRODUCTNAME XML Filters</link>
</variable></paragraph>
<paragraph role="heading" id="par_idN10923" xml-lang="en-US" level="2" l10n="NEW">About XML Filters</paragraph>
<paragraph role="paragraph" id="par_idN10927" xml-lang="en-US" l10n="CHG">%PRODUCTNAME <link href="text/shared/00/00000021.xhp">stores documents in XML format</link>. You can create customized filters that convert the native OpenDocument XML file format used by %PRODUCTNAME into another format. These filters can be integrated into %PRODUCTNAME seamlessly so that you can save or load these formats transparently.</paragraph>
<paragraph role="note" id="par_idN1093A" xml-lang="en-US" l10n="NEW">To create an XML filter, you must have a good understanding of XML and XSLT concepts. These concepts are beyond the scope of this help.</paragraph>
<paragraph role="paragraph" id="par_idN1093D" xml-lang="en-US" l10n="NEW">An XML filter contains <emph>stylesheets</emph> that are written in the XSLT language. The stylesheets define the transformation from the OpenDocument file format to another XML format through export and import filters. There are three types of XML filters:</paragraph>
<list type="unordered">
<listitem>
<paragraph role="paragraph" id="par_idN10947" xml-lang="en-US" l10n="NEW">
<emph>Import Filters</emph> load external XML files and transform the format of the files into the OpenDocument XML file format. After you install an import filter, the name of the filter is added to the list of file types in the <link href="text/shared/01/01020000.xhp">File Open dialog</link>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10960" xml-lang="en-US" l10n="NEW">
<emph>Export Filters</emph> transform OpenDocument XML files and <emph>save</emph> the files to a different XML format. After you install an export filter, the name of the filter is added to the list of file types in the <link href="text/shared/01/01070001.xhp">Export dialog</link>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10979" xml-lang="en-US" l10n="NEW">
<emph>Import/Export Filters</emph> load and save OpenDocument XML files into a different XML <emph>format</emph>. After you install these filters, the names of the filters are added to the list of file types in the <link href="text/shared/01/01020000.xhp">File Open dialog</link> and the <link href="text/shared/01/01070000.xhp">File Save As dialog</link>.</paragraph>
</listitem>
</list>
<paragraph role="heading" id="par_idN1053D" xml-lang="en-US" level="2" l10n="NEW">Creating an XML Filter for %PRODUCTNAME</paragraph>
<paragraph role="paragraph" id="par_idN109A9" xml-lang="en-US" l10n="NEW">When you create an XML filter for %PRODUCTNAME, you need to design an <emph>XSLT stylesheet</emph> that can convert to and from the OpenDocument XML file format.</paragraph>
<paragraph role="tip" id="par_idN109B0" xml-lang="en-US" l10n="NEW">For more information about the OpenDocument XML format, go to <link href="http://xml.openoffice.org/">http://xml.openoffice.org/</link>.</paragraph>
<paragraph role="paragraph" id="par_idN109C5" xml-lang="en-US" l10n="NEW">If you want, you can include a <emph>template</emph> with your filter to apply %PRODUCTNAME styles to an XML document that you import.</paragraph>
<paragraph role="paragraph" id="par_idN109CC" xml-lang="en-US" l10n="NEW">You can also include the <emph>Document Type Definition</emph> (DTD) for the for the external XML format so you can validate the XML format, for example, when you test the filter.</paragraph>
<paragraph role="heading" id="par_idN10531" xml-lang="en-US" level="2" l10n="NEW">To create an XML filter</paragraph>
<list type="ordered">
<listitem>
<paragraph role="paragraph" id="par_idN109E0" xml-lang="en-US" l10n="NEW">Create an XSLT transformation <emph>stylesheet</emph> that maps the elements of the external XML format to the elements of the OpenDocument XML file format and back again.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN109E8" xml-lang="en-US" l10n="NEW">Create a template that assigns %PRODUCTNAME styles to elements in the external XML format when you import a file in this format into %PRODUCTNAME.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN109EC" xml-lang="en-US" l10n="NEW">In %PRODUCTNAME Writer, create a text document, and choose <item type="menuitem">Tools - XML Filter Settings</item>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN109F4" xml-lang="en-US" l10n="NEW">Click <emph>New</emph>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN109FC" xml-lang="en-US" l10n="NEW">In the <emph>XML Filter</emph> dialog, click the <emph>General</emph> tab, and define the properties of the filter.</paragraph>
</listitem>
</list>
<list type="unordered">
<listitem>
<paragraph role="paragraph" id="par_idN10A03" xml-lang="en-US" l10n="NEW">In the <emph>Filter Name</emph> box, enter a name for the XML filter.</paragraph>
<paragraph role="paragraph" id="par_idN10CA1" xml-lang="en-US" l10n="NEW">This name is displayed in the <emph>XML Filter Settings</emph> dialog.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10A09" xml-lang="en-US" l10n="NEW">In the <emph>Application</emph> box, select the %PRODUCTNAME application that the filter is for.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10A0F" xml-lang="en-US" l10n="NEW">In the <emph>Name of File Type</emph> box, enter the file type that the filter is for.</paragraph>
<paragraph role="paragraph" id="par_idN10CC6" xml-lang="en-US" l10n="NEW">This name is displayed in the list of file types in the <emph>Open</emph>, <emph>Export</emph>, and <emph>Save As</emph> dialogs.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10A15" xml-lang="en-US" l10n="NEW">In the <emph>File extension</emph> box, enter the extension for the exported file.</paragraph>
<paragraph role="note" id="par_idN10A1B" xml-lang="en-US" l10n="NEW">To differentiate the file from other XML files, enter an extension other than *.xml.</paragraph>
</listitem>
</list>
<list type="ordered" startwith="6">
<listitem>
<paragraph role="paragraph" id="par_idN10A1F" xml-lang="en-US" l10n="NEW">On the <emph>Transformation</emph> tab page, define the transformation properties for the filter.</paragraph>
</listitem>
</list>
<list type="unordered">
<listitem>
<paragraph role="paragraph" id="par_idN10A26" xml-lang="en-US" l10n="NEW">(Optional) In the <emph>DocType</emph> box, enter the document type identifier for the external file format.</paragraph>
<paragraph role="paragraph" id="par_idN10D0E" xml-lang="en-US" l10n="NEW">This identifier is used to detect the file type on import.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10A2C" xml-lang="en-US" l10n="NEW">(Optional) In the <emph>DTD</emph> box, enter the path and file name of the DTD for the external file format.</paragraph>
<paragraph role="paragraph" id="par_idN10D1F" xml-lang="en-US" l10n="NEW">This DTD is used to validate the files on export.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10A32" xml-lang="en-US" l10n="NEW">In the <emph>XSLT for export</emph> box, enter the path and file name of the XSLT stylesheet that defines the transformation from OpenDocument format to the external format.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10A38" xml-lang="en-US" l10n="NEW">In the <emph>XSLT for import</emph> box, enter the path and file name to the XSLT stylesheet that defines the transformation from the external format to OpenDocument format.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10A3E" xml-lang="en-US" l10n="NEW">(Optional) In the <emph>Template for import</emph> box, enter the path and name of the template that defines the %PRODUCTNAME styles that are used in the imported file.</paragraph>
<paragraph role="note" id="par_idN10A44" xml-lang="en-US" l10n="NEW">The files that are specified on the <emph>Transformation</emph> tab page are copied to the local %PRODUCTNAME users directory.</paragraph>
</listitem>
</list>
<list type="ordered" startwith="7">
<listitem>
<paragraph role="paragraph" id="par_idN10A4C" xml-lang="en-US" l10n="NEW">Click <emph>OK</emph>.</paragraph>
</listitem>
</list>
<paragraph role="heading" id="par_idN10A56" xml-lang="en-US" level="2" l10n="NEW">To test an XML filter</paragraph>
<paragraph role="paragraph" id="par_idN10A5A" xml-lang="en-US" l10n="NEW">You can perform basic tests on a custom XML filter in %PRODUCTNAME.</paragraph>
<paragraph role="note" id="par_idN10A91" xml-lang="en-US" l10n="NEW">The document is not altered by these tests. </paragraph>
<list type="ordered">
<listitem>
<paragraph role="paragraph" id="par_idN10A60" xml-lang="en-US" l10n="NEW">Create or open a text document.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10A67" xml-lang="en-US" l10n="NEW">Choose <item type="menuitem">Tools - XML Filter Settings</item>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10A6F" xml-lang="en-US" l10n="NEW">In the list of filters, select the filter that you want to test, and click <emph>Text XSLTs</emph>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10A82" xml-lang="en-US" l10n="NEW">To test an <emph>Export</emph> Filter, do one of the following in the <emph>Export</emph> area of the dialog:</paragraph>
</listitem>
</list>
<list type="unordered">
<listitem>
<paragraph role="paragraph" id="par_idN10DEB" xml-lang="en-US" l10n="NEW">Click <emph>Browse</emph>, select the %PRODUCTNAME document that you want to test, and click <emph>Open</emph>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10DF7" xml-lang="en-US" l10n="NEW">To test the current document, click <emph>Current Document</emph>.</paragraph>
</listitem>
</list>
<list type="ordered" startwith="5">
<listitem>
<paragraph role="paragraph" id="par_idN10A99" xml-lang="en-US" l10n="NEW">To test an <emph>Import</emph> Filter, click <emph>Browse</emph> in the <emph>Import</emph> area of the dialog, select a document, and click <emph>Open</emph>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10E32" xml-lang="en-US" l10n="NEW">To validate the transformed file against the specified DTD, click <emph>Validate</emph>.</paragraph>
</listitem>
</list>
<paragraph role="heading" id="par_idN10ABC" xml-lang="en-US" level="2" l10n="NEW">Distributing An XML Filter As Package</paragraph>
<paragraph role="paragraph" id="par_idN10AC0" xml-lang="en-US" l10n="NEW">You can distribute an XML filter to multiple users using a special package format.</paragraph>
<paragraph role="heading" id="par_idN10AC3" xml-lang="en-US" level="3" l10n="NEW">To save an XML filter as a package</paragraph>
<paragraph role="note" id="par_idN10ACD" xml-lang="en-US" l10n="NEW">The XML Filter Settings dialog is only available when a text document is open.</paragraph>
<list type="ordered">
<listitem>
<paragraph role="paragraph" id="par_idN10ACA" xml-lang="en-US" l10n="NEW">In Writer, choose <item type="menuitem">Tools - XML Filter Settings</item>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10AD9" xml-lang="en-US" l10n="NEW">Select the filter that you want to distribute and click <emph>Save As Package</emph>.</paragraph>
</listitem>
</list>
<paragraph role="heading" id="par_idN10AE0" xml-lang="en-US" level="3" l10n="NEW">To install an XML filter from a package</paragraph>
<paragraph role="note" id="par_idN10AEA" xml-lang="en-US" l10n="NEW">The XML Filter Settings dialog is only available when a text document is opened.</paragraph>
<list type="ordered">
<listitem>
<paragraph role="paragraph" id="par_idN10AE7" xml-lang="en-US" l10n="NEW">In Writer, choose <item type="menuitem">Tools - XML Filter Settings</item>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10AF6" xml-lang="en-US" l10n="NEW">Click <emph>Open Package</emph> and select the package file with the filter you want to install.</paragraph>
</listitem>
</list>
<paragraph role="heading" id="par_idN10535" xml-lang="en-US" level="2" l10n="NEW">To delete an installed XML filter</paragraph>
<list type="ordered">
<listitem>
<paragraph role="paragraph" id="par_idN10B0A" xml-lang="en-US" l10n="NEW">In Writer, choose <item type="menuitem">Tools - XML Filter Settings</item>.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_idN10B19" xml-lang="en-US" l10n="NEW">Select the filter you want to delete and click <emph>Delete</emph>.</paragraph>
</listitem>
</list>
<section id="relatedtopics">
<paragraph role="paragraph" id="par_idN10B39" xml-lang="en-US" l10n="NEW"><link href="http://www.w3.org/Style/XSL/">World Wide Web Consortium Pages on Extensible <emph>Stylesheet</emph> Language (XSL)</link></paragraph>
<paragraph role="paragraph" id="par_idN10B4E" xml-lang="en-US" l10n="NEW"><link href="http://www.w3.org/XML/">World Wide Web Consortium Pages on Extensible Markup Language (XML)</link></paragraph>
<paragraph role="paragraph" id="par_idN10D97" xml-lang="en-US" l10n="NEW">
<embedvar href="text/shared/00/00000021.xhp#xmlformat"/>
</paragraph>
</section>
</body>
</helpdocument>