1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--***********************************************************
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements.  See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership.  The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License.  You may obtain a copy of the License at
12 *
13 *   http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied.  See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
22 ***********************************************************-->
23
24<helpdocument version="1.0">
25<meta>
26<topic id="textsharedguidexsltfilter_createxhp" indexer="include" status="PUBLISH">
27<title xml-lang="en-US" id="tit">Creating XML Filters</title>
28<filename>/text/shared/guide/xsltfilter_create.xhp</filename>
29</topic>
30</meta>
31<body>
32<bookmark xml-lang="en-US" branch="index" id="bm_id7007583">
33<bookmark_value>testing XML filters</bookmark_value>
34<bookmark_value>XML filters;creating/testing</bookmark_value>
35</bookmark><comment>mw moved 2 index entries from xsltfilter.xhp, then changed "XML filters;"</comment>
36<paragraph xml-lang="en-US" id="hd_id1413922" role="heading" level="1" l10n="NEW"><variable id="xsltfilter"><link href="text/shared/guide/xsltfilter_create.xhp">Creating XML Filters</link>
37</variable></paragraph>
38<paragraph xml-lang="en-US" id="par_idN1053D" role="heading" level="2" l10n="NEW">Creating an XML Filter for %PRODUCTNAME</paragraph>
39<paragraph xml-lang="en-US" id="par_idN109A9" role="paragraph" 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>
40<paragraph xml-lang="en-US" id="par_idN109B0" role="tip" l10n="NEW">For more information about the OpenDocument XML format, go to <link href="https://xml.openoffice.org/">https://xml.openoffice.org/</link>.</paragraph>
41<paragraph xml-lang="en-US" id="par_idN109C5" role="paragraph" 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>
42<paragraph xml-lang="en-US" id="par_idN109CC" role="paragraph" l10n="CHG">You can also include the <emph>Document Type Definition</emph> (DTD) for the external XML format so you can validate the XML format, for example, when you test the filter.</paragraph>
43<paragraph xml-lang="en-US" id="par_idN10531" role="heading" level="2" l10n="NEW">To Create an XML Filter</paragraph>
44<list type="ordered">
45<listitem>
46<paragraph xml-lang="en-US" id="par_idN109E0" role="paragraph" 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>
47</listitem>
48<listitem>
49<paragraph xml-lang="en-US" id="par_idN109E8" role="paragraph" 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>
50</listitem>
51<listitem>
52<paragraph xml-lang="en-US" id="par_idN109EC" role="paragraph" l10n="NEW">In %PRODUCTNAME Writer, create a text document, and choose <item type="menuitem">Tools - XML Filter Settings</item>.</paragraph>
53</listitem>
54<listitem>
55<paragraph xml-lang="en-US" id="par_idN109F4" role="paragraph" l10n="NEW">Click <emph>New</emph>.</paragraph>
56</listitem>
57<listitem>
58<paragraph xml-lang="en-US" id="par_idN109FC" role="paragraph" l10n="NEW">In the <emph>XML Filter</emph> dialog, click the <emph>General</emph> tab, and define the properties of the filter.</paragraph>
59</listitem>
60</list>
61<list type="unordered">
62<listitem>
63<paragraph xml-lang="en-US" id="par_idN10A03" role="paragraph" l10n="NEW">In the <emph>Filter Name</emph> box, enter a name for the XML filter.</paragraph>
64<paragraph xml-lang="en-US" id="par_idN10CA1" role="paragraph" l10n="NEW">This name is displayed in the <emph>XML Filter Settings</emph> dialog.</paragraph>
65</listitem>
66<listitem>
67<paragraph xml-lang="en-US" id="par_idN10A09" role="paragraph" l10n="NEW">In the <emph>Application</emph> box, select the %PRODUCTNAME application that the filter is for.</paragraph>
68</listitem>
69<listitem>
70<paragraph xml-lang="en-US" id="par_idN10A0F" role="paragraph" l10n="NEW">In the <emph>Name of File Type</emph> box, enter the file type that the filter is for.</paragraph>
71<paragraph xml-lang="en-US" id="par_idN10CC6" role="paragraph" 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>
72</listitem>
73<listitem>
74<paragraph xml-lang="en-US" id="par_idN10A15" role="paragraph" l10n="NEW">In the <emph>File extension</emph> box, enter the extension for the exported file.</paragraph>
75<paragraph xml-lang="en-US" id="par_idN10A1B" role="note" l10n="NEW">To differentiate the file from other XML files, enter an extension other than *.xml.</paragraph>
76</listitem>
77</list>
78<list type="ordered" startwith="6">
79<listitem>
80<paragraph xml-lang="en-US" id="par_idN10A1F" role="paragraph" l10n="NEW">On the <emph>Transformation</emph> tab page, define the transformation properties for the filter.</paragraph>
81</listitem>
82</list>
83<list type="unordered">
84<listitem>
85<paragraph xml-lang="en-US" id="par_idN10A26" role="paragraph" l10n="NEW">(Optional) In the <emph>DocType</emph> box, enter the document type identifier for the external file format.</paragraph>
86<paragraph xml-lang="en-US" id="par_idN10D0E" role="paragraph" l10n="NEW">This identifier is used to detect the file type on import.</paragraph>
87</listitem>
88<listitem>
89<paragraph xml-lang="en-US" id="par_idN10A2C" role="paragraph" l10n="NEW">(Optional) In the <emph>DTD</emph> box, enter the path and file name of the DTD for the external file format.</paragraph>
90<paragraph xml-lang="en-US" id="par_idN10D1F" role="paragraph" l10n="NEW">This DTD is used to validate the files on export.</paragraph>
91</listitem>
92<listitem>
93<paragraph xml-lang="en-US" id="par_idN10A32" role="paragraph" 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>
94</listitem>
95<listitem>
96<paragraph xml-lang="en-US" id="par_idN10A38" role="paragraph" 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>
97</listitem>
98<listitem>
99<paragraph xml-lang="en-US" id="par_idN10A3E" role="paragraph" 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>
100<paragraph xml-lang="en-US" id="par_idN10A44" role="note" l10n="NEW">The files that are specified on the <emph>Transformation</emph> tab page are copied to the local %PRODUCTNAME users directory.</paragraph>
101</listitem>
102</list>
103<list type="ordered" startwith="7">
104<listitem>
105<paragraph xml-lang="en-US" id="par_idN10A4C" role="paragraph" l10n="NEW">Click <emph>OK</emph>.</paragraph>
106</listitem>
107</list>
108<paragraph xml-lang="en-US" id="par_idN10A56" role="heading" level="2" l10n="NEW">To Test an XML Filter</paragraph>
109<paragraph xml-lang="en-US" id="par_idN10A5A" role="paragraph" l10n="NEW">You can perform basic tests on a custom XML filter in %PRODUCTNAME.</paragraph>
110<paragraph xml-lang="en-US" id="par_idN10A91" role="note" l10n="NEW">The document is not altered by these tests.</paragraph>
111<list type="ordered">
112<listitem>
113<paragraph xml-lang="en-US" id="par_idN10A60" role="paragraph" l10n="NEW">Create or open a text document.</paragraph>
114</listitem>
115<listitem>
116<paragraph xml-lang="en-US" id="par_idN10A67" role="paragraph" l10n="NEW">Choose <item type="menuitem">Tools - XML Filter Settings</item>.</paragraph>
117</listitem>
118<listitem>
119<paragraph xml-lang="en-US" id="par_idN10A6F" role="paragraph" l10n="CHG">In the list of filters, select the filter that you want to test, and click <emph>Test XSLTs</emph>.</paragraph>
120</listitem>
121<listitem>
122<paragraph xml-lang="en-US" id="par_idN10A82" role="paragraph" l10n="NEW">To test an <emph>Export</emph> Filter, do one of the following in the <emph>Export</emph> area of the dialog:</paragraph>
123</listitem>
124</list>
125<list type="unordered">
126<listitem>
127<paragraph xml-lang="en-US" id="par_idN10DEB" role="paragraph" l10n="NEW">Click <emph>Browse</emph>, select the %PRODUCTNAME document that you want to test, and click <emph>Open</emph>.</paragraph>
128</listitem>
129<listitem>
130<paragraph xml-lang="en-US" id="par_idN10DF7" role="paragraph" l10n="NEW">To test the current document, click <emph>Current Document</emph>.</paragraph>
131</listitem>
132</list>
133<list type="ordered" startwith="5">
134<listitem>
135<paragraph xml-lang="en-US" id="par_idN10A99" role="paragraph" 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>
136</listitem>
137<listitem>
138<paragraph xml-lang="en-US" id="par_idN10E32" role="paragraph" l10n="NEW">To validate the transformed file against the specified DTD, click <emph>Validate</emph>.</paragraph>
139</listitem>
140</list>
141<section id="relatedtopics">
142<paragraph xml-lang="en-US" id="par_id8579668" role="paragraph" l10n="NEW"><link href="text/shared/guide/xsltfilter.xhp">About XML Filters</link></paragraph>
143<paragraph xml-lang="en-US" id="par_id5569017" role="paragraph" l10n="NEW"><link href="text/shared/guide/xsltfilter_distribute.xhp">Distributing XML filters</link></paragraph>
144</section>
145</body>
146</helpdocument>
147