This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Can one <xsl:choose> <xsl:output>?


Given the following input document:

<?xml version="1.0" encoding="UTF-8"?>

<response TYPE="Table">
<data>1</data>
<data>15.2</data>
</response>

The output of the transformation could be directed to a  Chart, or
To a Table, depending on the TYPE attribute.
Chart has ABChartData.dtd, and Table has ABTableData.dtd.

In the xsl, I want to do something like:
<xsl:choose>
<xsl:when test="response/@TYPE='Table'">
  <xsl:output doctype-system="TableData.dtd"/>
</xsl:when>
<xsl:otherwise>
<xsl:output doctype-system="ChartData.dtd"/>
</xsl:otherwise>
</xsl:choose>

I get an error saying the tag <xsl:output> is not allowed in this location.

Questions:
1. How can this be done?
2. I am using Xalan Java API.   Is there any way
to pass the value of doctype-system attribute to the transform?
Assuming that I am able to determine the value through some
other means before doing the transform.

Thanks a lot for your help.

-sm

Further information:

The API for supplying the xml (after transformation)
to Chart or to Table requires that the XML be of the form:

<!--For Chart -->
<?xml version="1.0"?>
     <!DOCTYPE ABChartData SYSTEM "ABChartData.dtd">
     <ABChartData Name="Item Code vs Price" >
       <PointLabel> Mercury </PointLabel>
       <Series>
         <SeriesLabel>Price</SeriesLabel>
         <XData>1</Xdata>
         <YData>15.2</YData>
       </Series>
     </ABChartData>

<!--For Table -->
<?xml version="1.0" >
<!DOCTYPE ABTableData SYSTEM "ABTableData.dtd">
<ABTableData >

	<ColumnLabel>Item Code</ColumnLabel>
	<ColumnLabel>Price</ColumnLabel>
	<Row>
		<RowLabel/>
		<Cell>1</Cell>
		<Cell>15.2</Cell>
	</Row>
</ABTableData>
=== END ===

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]