Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 13th, 2012, 02:20 AM
Authorized User
 
Join Date: Sep 2011
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default XSL Output

Hi

I have XSL I created, that display output recieved from xml from Store Procedure.

My XSL has labels which are headings of columns, then for-each block for my output.

My output doesn't have to come belows my columns, I need to have something like this:

Column Value (first format)
-----------------
Name: Tom
Last Name: Brown

*NOT* (Second format)
-----
Name Last Name
Tom Brown

How do I display the output like in the first format, because my FOR-EACH clause in the xsl is the one taking data from Store Proc and displaying it.
 
Old September 13th, 2012, 04:31 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Without having any idea of your source XML, it's impossible to give you any useful advice. The problem looks very easy, so it would be useful for you to show us your best attempt, because then we'll be able to see where you have gone wrong and to put you right. We also need to know the desired output in XML/HTML terms - if it's HTML you need to say so.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old September 13th, 2012, 04:58 AM
Authorized User
 
Join Date: Sep 2011
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:user="http://www.selestia.co.uk/namespace">
<xsl:import href="Common.IA.Header.Xsl" />
<xsl:import href="Common.IA.Footer.Xsl" />
<xsl:output indent="yes" encoding="UTF-8" />
<xsl:template match="/">
<xsl:variable name="AppId">
<xsl:value-of select="//activityProperties/property[@name='txtAppId']" />
</xsl:variable>
<!--Criteria-->
<xsl:choose>
<xsl:when test="//activityProperties/property[@name='exportType'] = ''">
<xsl:call-template name="Common.IA.Header" />
<table>
<tr>
<td height="20" valign="middle">
Application Id:
</td>
<td width="5"></td>
<td>
<input class="AllFields" name="txtAppId" id="txtAppId">
<xsl:attribute name="value">
<xsl:value-of select="$AppId" />
</xsl:attribute>
</input>
</td>
</tr>
<tr>
<td>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</td>
</tr>
<tr>
<td>
<a href="#" onclick="javascript: btnSubmit_onclick()">
<img src="/images/search_butt.gif" border="0" />
</a>
</td>
</tr>
</table>
</xsl:when>
<xsl:when test="//activityProperties/property[@name='exportType'] = 'excel'">
</xsl:when>
</xsl:choose>
<!--Results-->
<table width="200" cellpadding="0" cellspacing="0">
<thead>
<xsl:if test="//activityProperties/property[@name='exportType']=''">
<tr>
<td>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</td>
</tr>
<tr>
<td colspan="13">
<a href="#">
<xsl:attribute name="onclick">javascript: window.open('BFGenList.aspx?_wpid=<xsl:value-of select="//pageProperties/property[@name='$Sys_PageId']" />&amp;exportType=excel','hhh','width=716,height=60 0, toolbar=no,menubar=yes,location=no,scrollbars=yes, resizable=yes,status=yes,screenX=10,screenY=0,top= 10,left=10')</xsl:attribute>
Export to Excel</a>
</td>
</tr>
<tr>
<td>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</td>
</tr>
</xsl:if>
<tr>
<td class="TableHeaderDarkSmlText" height="25">Application Id</td>
<td>
</td>
</tr>
<tr>
<td class="TableHeaderDarkSmlText" height="25">Policy Id</td>
</tr>
<tr>
<td class="TableHeaderDarkSmlText" height="25">Date of Disinvestment</td>
</tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr>
<td colspan="2" class="TableHeaderDarkSmlText" height="25">Summary</td>
</tr>
<tr>
<td colspan="4" class="TableHeaderDarkSmlText" height="25">Original Investment Value</td>

</tr>
<tr>
<td colspan="4" class="TableHeaderDarkSmlText" height="25">Encashment Value</td>
</tr>
<tr>
<td colspan="4" class="TableHeaderDarkSmlText" height="25">Top-Up Commission</td>
</tr>
<tr>
<td colspan="4" class="TableHeaderDarkSmlText" height="25">Payout Value</td>
</tr>
</thead>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tbody id="tbData">
<xsl:for-each select="//report/SO">
<tr>
<td class="TableCellLightSmlText" height="25" nowrap="1">
<xsl:value-of select="Application_Id" />
</td>
</tr>
<tr>
<td class="TableCellLightSmlText" height="25" nowrap="1">
<xsl:value-of select="Policy_Id" />
</td>
</tr>
<tr>
<td class="TableCellLightSmlText" height="25" nowrap="1">
<xsl:value-of select="Date_Of_Disinvestment" />
</td>
</tr>

<tr><td> </td></tr>
<tr><td> </td></tr>

<tr>
<td class="TableCellLightSmlText" height="25" nowrap="1">
<xsl:value-of select="Original_Investment_Value" />
</td>
</tr>
<tr>
<td class="TableCellLightSmlText" height="25" nowrap="1">
<xsl:value-of select="Encashment_Value" />
</td>
</tr>
<tr>
<td class="TableCellLightSmlText" height="25" nowrap="1">
<xsl:value-of select="Top-Up_Commission" />
</td>
</tr>
<tr>
<td class="TableCellLightSmlText" height="25" nowrap="1">
<xsl:value-of select="Payout_Value" />
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
<xsl:call-template name="Common.IA.Footer" />
</xsl:template>
</xsl:stylesheet>
 
Old September 13th, 2012, 05:11 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Yuk. Horrible monolithic code, badly formatted, using disable-output-escaping quite unnecessarily. This is the kind of thing that gives XSLT a bad reputation. And still you haven't given any source XML, or explained in any way how this code relates to your question.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
why xsl:value-of dosen't give out any output ehsansad XSLT 3 October 13th, 2010 08:15 AM
output xsl in predefined template newuser2525 XSLT 1 December 24th, 2007 08:30 AM
XSL html output problem aiyer0912 XSLT 11 November 8th, 2006 07:19 AM
xsl:element not on its own line in output EstherMStrom XSLT 3 February 26th, 2005 06:08 AM
PDF output problem using XSL pulavarthi XSLT 1 November 6th, 2003 05:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.