Re: read/write in the same xml file
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 ------ ----
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.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format