[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: read/write in the same xml file

Subject: Re: read/write in the same xml file
From: abbouh <abbouh@xxxxxxxxxxxxxxxxx>
Date: Wed, 11 Jun 2003 10:21:26 +0000
xslt character position
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.