[xsl] XML 2 XML

Subject: [xsl] XML 2 XML
From: Rosa I-Ting Cheng <Rosa@xxxxxxxxxxxxx>
Date: Thu, 25 Jan 2001 10:41:53 +1100
yes I had that in my XSL stylesheet, but this is the result shown on the
ie5.5:
1998 FORD 0 no answer no answer no answer Suncorp Metway Motor 

here's the XSLT:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="xml" indent="yes"/>

<xsl:template match="/" xml:space="preserve">
   <xsl:apply-templates select="Questions"/>
</xsl:template>

<xsl:template match="Questions">
   <xsl:element name="{name()}">
   <xsl:apply-templates select="Question"/>
   </xsl:element>
</xsl:template>

<xsl:template match="Question">
   <xsl:element name="{name()}">
   <xsl:for-each select=".">
   <xsl:variable name="ansTag" select="AnswerTag/."/>
<!--   <xsl:for-each select="*">
      <xsl:element name="{name()}"><xsl:value-of select="."/></xsl:element>
   </xsl:for-each>-->
   <xsl:for-each select="document('Ans.xml')/Notify/RiskDetails/*">
   <xsl:if test="name() = $ansTag">
      <xsl:choose>
      <xsl:when test=".=''">
         no answer
      </xsl:when>
      <xsl:otherwise>
         <xsl:element name="Answer"><xsl:value-of select="."/></xsl:element>
      </xsl:otherwise>
      </xsl:choose>
   </xsl:if>
   </xsl:for-each>
   </xsl:for-each>
   </xsl:element>
</xsl:template>

</xsl:stylesheet>

here's the XML:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="insurance.xsl"?>

<Questions>
   <Question>
      <Caption>How old is your car?</Caption>
      <AnswerTag>Year</AnswerTag>
   </Question>
   <Question>
      <Caption>What kind(brand) of car is it?</Caption>
      <AnswerTag>VehicleMake</AnswerTag>
   </Question>
   <Question>
      <Caption>What is your car's Vehicle ID?</Caption>
      <AnswerTag>VehicleID</AnswerTag>
   </Question>
   <Question>
      <Caption>What is the Age of the second additional driver?</Caption>
      <AnswerTag>SecondAdditionalDriverAge</AnswerTag>
   </Question>
   <Question>
      <Caption>What is the percentage driven for the second
driver?</Caption>
      <AnswerTag>SecondAdditionalPercentageDriven</AnswerTag>
   </Question>
   <Question>
      <Caption>How many years is the second driver licensed?</Caption>
      <AnswerTag>SecondAdditionalDriverYearsLicensed</AnswerTag>
   </Question>
   <Question>
      <Caption>What is the insurer's ID?</Caption>
      <AnswerTag>InsurerID</AnswerTag>
   </Question>
</Questions>

and I'm not using an ASP. just double clicking on the file in the Explorer.

-----Original Message-----
From: Adam Van Den Hoven [mailto:Adam.Hoven@xxxxxxxxxxxx]
Sent: Thursday, 25 January 2001 10:16 AM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE: [xsl] XML 2 XML


You want to use a <xsl:output method='xml' /> tag and you should get what
you are looking for. Otherwise, if you are generating this output from asp,
you may have to set the content type to "text/xml"

> -----Original Message-----
> From: Rosa I-Ting Cheng [mailto:Rosa@xxxxxxxxxxxxx]
> Sent: Wednesday, January 24, 2001 3:05 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: [xsl] XML 2 XML
> 
> 
> Well at the moment I've written an XSL for my XML for it to 
> transform into
> another XML. I do know how to see the result HTML for 
> transformations that
> goes from XML to HTML: just double click on the icon in the explorer.
> However, when I double click for a transformation that goes 
> XML to XML, all
> i see are the texts that comes between tags.  How can I see 
> the tranformed
> new XML in a format such as
> 
> <tag1>
>    <tag2/>
>    <tag3/>
> </tag1>
> 
>  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