[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: Thu, 12 Jun 2003 10:46:08 +0000 |
but i have onther problem: each time i use documet() for reading a counter in an extern file "compte.xml" i receive the first value which existed in compte.xml at the begining, even if in between times i use redirect for writing in this file. note that my input and output file aren't interessant for me in this example. this an example: compte.xml: <document><compte>10</compte></document> compte.xsl: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect" extension-element-prefixes="redirect"> <xsl:output method="text" version="1.0" encoding="ISO-8859-1" indent="yes" omit-xml-declaration="yes" /> <xsl:template match="/"> <xsl:call-template name="operation"> <xsl:with-param name="fichier" select="'compte.xml'"/> </xsl:call-template> <xsl:call-template name="operation"> <xsl:with-param name="fichier" select="'compte.xml'"/> </xsl:call-template> </xsl:template> <xsl:template name="operation"> <xsl:param name="fichier" select="'compte.xml'"/> <xsl:variable name="vcompte"> <xsl:value-of select="document($fichier)/document/compte"/> </xsl:variable> <redirect:close file="compte.xml"/> <xsl:variable name="somme"> <xsl:value-of select="'<document><compte>'"/> <xsl:value-of select="$vcompte + 100"/> <xsl:value-of select="'</compte></document>'"/> </xsl:variable> <redirect:open file="compte.xml"/> <redirect:write file="compte.xml" method="text"> <xsl:value-of select="$somme"/> </redirect:write> <redirect:close file="compte.xml"/> </xsl:template> </xsl:stylesheet> but i have in the end: <document><compte>110</compte></document> what i should have is: <document><compte>210</compte></document> abbouh a écrit : > it was a wrong problem ,because we can read/write from an external document > using(document(),xsl:redirect) > i have a mistake in the xsl steelsheet > so i'm sorry,and thanks for all > > abbouh a écrit : > > > right, > > i give you an example for xml file > > but my xml file is more convoluted, there is different noeud,tags, > > reference to others doc > > my xml file have the dicodoc DTD ,so it's more difficult with this solution > > > > Mike Haarman a écrit : > > > > > From: <Jarno.Elovirta@xxxxxxxxx> > > > > > > abbouh wrote: > > > > > > > > this is an example for what i want to do: > > > > > > > > > > table of contents: > > > > > paragraph1 12 32 > > > > > paragraph2 44 59 > > > > > > > > > > > > > > > > Feels really silly to write stylesheets like this... > > > > > > > > > > It should. This is not a solution. You've hardcoded an offset to accomodate > > > the characters that make up the tags leading the first strings of content. Any > > > other leading markup will break the stylesheet. > > > > > > Abbouh, as Wendell pointed out, XSLT treats with nodes, not tags. I suppose it > > > possible that one could trick up the stylesheet to work with strings returned by > > > local-name() to correct the offset, but I think it is fair to say that any > > > solution using XSLT would be very brittle. > > > > > > hth, > > > > > > Mike > > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] read/write in the same xm, abbouh | Thread | Re: [xsl] read/write in the same xm, David Carlisle |
[xsl] Grouping problem, Andy . Stephen | Date | Re: [xsl] Grouping problem, David Carlisle |
Month |