Yermo Lamers wrote:
> I originally posted this questions to [EMAIL PROTECTED] That's a
> very low volume list. So I posted the question to users@ and someone there
> suggested I post my question here.
> 
> I would like to use Writer to generate context sensitive help
> documentation for a web application.
> 
> What I would like to do is "tag" sections of the document with unique
> codes that I can then use to build an index. These tags would be included
> in an HTML export and then referenced from a web app.
> 
> It seems like this would be something that has already been done, but I
> did quite a bit of searching and haven't found anything.
> 
> I figure I could modify the XSLT export to HTML examples to include these
> codes as <a name="FOOBAR"> tags. I could then write a little indexing
> script that would map which HTML documentation file contains which code.
> 
> From there it's simple to do a lookup from the webapp, load the right help
> page and jump down to the code.
> 
> What should I use to tag sections? I thought about using the comment
> feature or maybe a custom style is the right answer?

We are using a similar approach to write the OOo application help files
(xml format) using OOo. For elements that are unknown to OOo I use
either paragraph styles (for block elements) or character styles (for
inline elements). Of course, this only works if you don't need attribute
values. If you do, you can use variables.

> If I were to use OO comments in the Writer doc for my tags how do I
> reference them from the XSLT?

If you use the "XML Filter" feature, you can write your own outout
filter very easily using xslt style sheets. You need to look at the
file format specification to know what element represents OOo comments
(or whatever ODF feature you use) in ODF.

You can either read the 700+ page specification:
http://www.oasis-open.org/committees/download.php/12572/OpenDocument-v1.0-os.pdf

or you can "reverse-engineer" by looking at the ODF "source" and
searching for the element. You can do this by unzipping the ODF file
(it's a zip in disguise) and looking at the content.xml stream.

If you are using variables it would work like this:

1. Create a variable for your purpose, say "TAG"
2. At the first occurrence of this "element" in the document,
   press Ctrl-F2 and select the "Variables" tab
3. Select "Set variable" as Type, select "Text" as Format
4. Enter the Variable name , here: TAG
5. Enter the Variable value for this occurrence, say: foobar1

For every other occurrence of a "TAG", just go there and
repeat steps 2, 3, and 5. You can omit 4, since a variable
of that name already exists.

This way, you can create as many "TAG"s as you want.
In the ODF they should be represented by the

<text:variable-set text:name="TAG" text:value-type="string">
foobar1
</text:variable-set>

element which you can transform using XSLT.

> I've found this XSLT info: http://books.evc-cit.info/apb.php
> Are there any other documents I should be looking at?

> Any pointers in the roughly right direction would be greatly appreciated,

Hopefully, not too rough a pointer ;-)

Actually, with some tricks and tweaking, OOo can be used as a
generic XML editor (it's a bit bending backwards, but still).
I should someday write up a tutorial.

Frank

-- 
Frank Peters, Co-Lead
The OOo Documentation Project:
SIGN UP - PARTICIPATE - CONTRIBUTE
IT'S FREE! NO OBLIGATIONS!
http://documentation.openoffice.org
http://wiki.services.openoffice.org/wiki/Documentation

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to