[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] read/write in the same xml file


Subject: Re: [xsl] read/write in the same xml file
From: abbouh <abbouh@xxxxxxxxxxxxxxxxx>
Date: Wed, 11 Jun 2003 10:21:26 +0000

this is an example for what i want to do:

i supose this is my xml file:
<document>
<para>
<word>aaa</word>
<word>bbb</word>
<word>ccc</word>
<word>ddd</word>
<word>eee</word>
</para>
<para>
<word>kkk</word>
<word>fff</word>
<word>mmm</word>
<word>ppp</word>
</para>
</document>

my output file should have this structure:

table of contents:
paragraph1  12    32
paragraph2  44  59

paragraph1
aaa
bbb
ccc
ddd
eee
paragraph2
kkk
fff
mmm
ppp


so  the first paragraph begin in character 12 and finish in character 32
in the output file.


Wendell Piez a écrit :

> At 06:11 AM 6/10/2003, you wrote:
> >what i need is to know how much characters i have write in the output file
> >each time, because i want to make a table of contents like this:
> >paragraph1  begining  end
> >---------     ------    ----
> >paragraph i  ------     ----
> >
> >the begining and the end  position are exprimed in characters.
> >
> >so for this reason i want to use an extern file named compte.xml
> >which i will use in my stylesheet every time for knowing the position.
>
> Ah, well you could pass your external filename in as a parameter at
> runtime, instead of hardcoding it.
>
> As far as knowing how many characters precede a given position (say, the
> start of a paragraph), are you speaking of characters irrespective of
> markup, or characters including markup? That is, given
>
> <text>
>   <p>Here's paragraph one.</p>
>   <p>Here's paragraph two.</p>
> </text>
>
> Do you want the first p to yield 0 (or perhaps 2 if you count the
> whitespace after the <text> start tag) and the second, 21 (the length of
> the first p)? Or do you want an absolute character offset including the
> characters that appear in the start tags "<text>", "<p>" and so on?
>
> If the first, it can be done in XSLT, although it's not necessarily the
> best tool for the job. If you mean the second, XSLT is certainly *not* the
> tool for the job since the XSLT source tree (created by parsing the file)
> does not keep track of tags.
>
> Please clarify.
>
> Cheers,
> Wendell
>
> ======================================================================
> Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
> Mulberry Technologies, Inc.                http://www.mulberrytech.com
> 17 West Jefferson Street                    Direct Phone: 301/315-9635
> Suite 207                                          Phone: 301/315-9631
> Rockville, MD  20850                                 Fax: 301/315-8285
> ----------------------------------------------------------------------
>    Mulberry Technologies: A Consultancy Specializing in SGML and XML
> ======================================================================
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords