Re: [xsl] writing new values to an extra document

Subject: Re: [xsl] writing new values to an extra document
From: dvint@xxxxxxxxx
Date: Fri, 7 Nov 2008 08:27:38 -0500 (EST)
I had a problem similar to this where I needed to write the XML stream
out, but I also needed this sort of log as well. In my case I was trying
to make a list of all the graphics and create a batch file that would copy
the files from a common area (lots of unused graphics here) and move the
files I needed to an area I would use for delivery.

I used the <xsl:message> to write these to stdout, I sent that to a file
by piping the output, or just cut and pasted the messages into another
file.

Now this makes it hard to write debugging statements, but it saved me from
creating another stylesheet for just this purpose.

It would have been nice to just have the ability to write to a file as
needed from within the stylesheet; that would have been a cleaner
approach, but this satisfied my needs at the moment.

..dan

> Hi,
>
> I have a quite tricky one for you.
>
> I4m transforming files that have an element called 'gerichte'. Every week
> i get new files, and there is the possibility that there are new values
> for  'gerichte' that i didn4t know before. if that is the case i want to
> write the new and only the new ones into an extra file.
>
> Little more explanation:
>
> Let4s say i know the following values for 'gerichte': BSG, USG, OGH. Those
> are the ones that i did consider in my stylesheets.
> Now i get a delivery with new gerichte lets say: USK, VFGH, IAK. What i
> want now is that those are added to the extra file that already exists,
> and contains all known values for gerichte.
>
> <gerichte>
> <gericht>BSG</gericht>
> <gericht>USG</gericht>
> <gericht>OGH</gericht>
> <gericht>USK</gericht>
> <gericht>VFGH</gericht>
> <gericht>IAK</gericht>
> </gerichte>
>
> The problem now is that I have no clue how to switch between the two
> different result trees...
> I tried it with <xsl:result-document> but Saxon is giving me the error
> message
>
> Error at xsl:result-document on line 183 of transform.xsl:
>   XTDE1490: Cannot write more than one result document to the same URI:
>   file:/W:/technik/dev/xsl_dev/gerichte.xml
> ...
>
> Because I'm always writing to the same destination URI.
>
> Idea someone ?!
>
> Here4s what i have right now:
>
> ....
> <xsl:variable name="gerichtsDokument"
> select="document('../gerichte.xml')"/>
> <xsl:variable name="gerichtsWert" select="gericht"/>
>
>      <xsl:result-document href="../gerichte.xml">
>                 <gericht>
>                     <xsl:attribute name="date"
> select="format-date(current-date(), [D]-[M]-[Y]')"/>
>                     <xsl:value-of select="gericht"/>
>                 </gericht>
>       </xsl:result-document>
> ....
>
> cheers
>
> Patrick Szabo
> EPD / XSLT Konvertierung
> Tel.: +43-1-534 52-1573
> Fax.: +43-1-534 52-1573
> patrick.szabo@xxxxxxxxxxxxx
>
> LexisNexis Verlag ARD Orac GmbH & Co KG
> Marxergasse 25, 1030 Wien
> FN 8333f, Handelsgericht Wien
> www.lexisnexis.at <http://www.lexisnexis.at/>

Current Thread