cancel
Showing results for 
Search instead for 
Did you mean: 

Inline transform for Sql Query not working in SAP MII 12.1 Version 12.1.8 B

Former Member
0 Kudos

Hi All,

I applied an xslt for an sql query which returns an xml file.

I used inline transform icon in sql query to load an xsl file which has to return me a string

Any idea why is not working for me..?

My Sample XML file:

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

<?xml-stylesheet type="text/xsl" href="/XMII/CM/BatchDisposition/BatchQueueManagement/StyleSheets/ProductXsl.xsl"?>

<Rowsets DateCreated="2011-05-05T07:27:45" EndDate="2011-05-05T07:27:45" StartDate="2011-05-05T06:27:45" Version="12.1.8 Build(20)">

<Rowset>

<Columns>

<Column Description="ProductName" MaxRange="1" MinRange="0" Name="ProductName" SQLDataType="12" SourceColumn="ProductName"/>

</Columns>

<Row>

<ProductName>Asprin 100mg Tablets 12 x10 strip</ProductName>

</Row>

<Row>

<ProductName>Asprin 300mg Tablets 12 x10 strip</ProductName>

</Row>

<Row><ProductName>Ibprooven 200mg Tablets 12 x 10 strip</ProductName></Row>

<Row><ProductName>RipTide 50mg Tablets 40 x10 strip</ProductName></Row>

<Row><ProductName>Seroquel 200mg Tablets 6 x10 strip</ProductName></Row>

<Row><ProductName>Seroquel 400mg Tablets 12 x10 strip</ProductName></Row>

</Rowset>

</Rowsets>

My Sample XSl File:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<xsl:text>["</xsl:text>

<xsl:for-each select="Rowsets/Rowset/Row">

<xsl:value-of select="ProductName"/>

<xsl:if test="position() &lt; last()">

<xsl:text>","</xsl:text>

</xsl:if>

<xsl:if test="position()=last()">

<xsl:text>"]</xsl:text>

</xsl:if>

</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

Any Suggestions are Welcome:

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

jamie_cawley
Advisor
Advisor
0 Kudos

The query template transform feature still needs the data to be returned in MII format, otherwise it will not understand the response and nothing will be displayed. You should be able to use the stylesheet in a servlet defined on a web page without issue.

Jamie

Former Member
0 Kudos

I want data to be displayed in sql query by click on run button which has an xsl file loaded in inline transform

How can I achieve this..?

jamie_cawley
Advisor
Advisor
0 Kudos

Something like this should work...

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<Rowsets DateCreated="{Rowsets/@DateCreated}" Version="{Rowsets/@Version}" StartDate="{Rowsets/@StartDate}" EndDate="{Rowsets/@EndDate}">
			<xsl:copy-of select="/Rowsets/FatalError"/>
			<xsl:copy-of select="/Rowsets/Messages"/>
			<Rowset>
			<Columns>
				<Column Description="Mycol1" MaxRange="1" MinRange="0" Name="Mycol1" SQLDataType="12" SourceColumn="Mycol1" /> 
			</Columns>
			<Row>
			<Mycol1>
			<xsl:text>["</xsl:text>
				<xsl:for-each select="/Rowsets/Rowset/Row">
					<xsl:value-of select="." />
					<xsl:choose>
						<xsl:when test="position() &lt; last()"><xsl:text>","</xsl:text></xsl:when> 
						<xsl:otherwise><xsl:text>"]</xsl:text></xsl:otherwise> 
					</xsl:choose>
				</xsl:for-each>
			</Mycol1>
			</Row>
			</Rowset>
		</Rowsets>
	</xsl:template>
</xsl:stylesheet>