Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] appending to result-document

From: "Michael Kay" <mike@------------>
To:
Date: 8/2/2005 10:33:00 PM
You can't append to result documents in this way: you have to write them in
a single go, just as you would if you were writing the data to a branch of
the primary tree. In fact, that's how you should think about it: you're in
effect writing a single tree and then lopping off some of the branches to
act as separate result trees in their own right. (If it worked any
differently, the content of the result trees would depend on order of
execution, which isn't defined).

So as with a single-output transformation, the rule is to structure your
stylesheet according to the structure of the output; your problem is
probably that you have designed it to match the structure of the input.

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Rahil [mailto:qamar_rahil@xxxxxxxxxxx] 
> Sent: 02 August 2005 14:48
> To: XSL List
> Subject: [xsl] appending to result-document
> 
> Hi
> 
> I have an xsl file which has two output formats. The first 
> one is .html 
> and the other is a named xml output. I am using the 
> <xsl:result-document> instruction for the xml output as such
> 
> <xsl:stylesheet version="2.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> xmlns:saxon="http://saxon.sf.net/">
>     <xsl:output method="html"/>
>     <xsl:output name="log" method="xml" indent="yes"/>
> 
> The template where I have placed the <xsl:result-document> 
> instruction is:
> ----------------
> <xsl:template match="TR" mode="inner">
>         <xsl:copy>
>             <xsl:choose>
>                 <xsl:when test="..some test here">
>                          <TD>Some HTML output here !</TD>
>                    
>                     <xsl:result-document href="{$clsNm}.xml" 
> format="log" type-information="none">
>                         <Results>
>                             <Term><xsl:value-of 
> select="$clsNm"/></Term
>                         </Results>
>                     </xsl:result-document>
>                    .............
>     </xsl:copy>
> </xsl:template>
> ------------------
> 
> Now the <xsl:when> condition might be satisfied more than 
> once when the 
> <xsl:template> is called recursively. I dont want separate 
> .xml files in 
> <xsl:result-document>. In fact I want to append new <Text> element 
> results to a single .xml file.
> 
> The present output results in 3 files: (i) mainResult.html , (ii) 
> Log1.xml and (iii) Log2.xml
> 
> Log1.xml looks like this
> -------------
> <Results xmlns:saxon="http://saxon.sf.net/">
>    <Term>Log1</Term>
> </Results>
> 
> Log2.xml looks like this
> -------------
> <Results xmlns:saxon="http://saxon.sf.net/">
>    <Term>Log2</Term>
> </Results>
> 
> The output I want is two files: (i) mainResult.html , (ii) Log.xml
> -------------
> <Results xmlns:saxon="http://saxon.sf.net/">
>     <Term>Log1</Term>
>    <Term>Log2</Term>
> </Results>
> -----------------
> 
> How do I append xml tags in the log.xml file in the midst of general 
> .html output ?
> 
> Appreciate all help.
> 
> Thanks
> Rahil


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent