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 January 27th, 2004, 01:21 PM
Authorized User
 
Join Date: Jan 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default space creeping into <td> elements

Basically, my XSLT reads

Code:
<td><img...></td>
however, the HTML output reads

Code:
<td>
    <img...>
</td>
Now, if <xsl:output> is set to indent=no, then the problem is cured. Unfortunately, I require this "pretty-printing" for human-readability of the beginning meta elements.

This "space creeping" I know is a problem of HTML; however, is there a clean/simply way to preserve the formatting actually like the first example above?


 
Old January 27th, 2004, 05:46 PM
Authorized User
 
Join Date: Jan 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I created a template to handle the output of each TR element. Here I wrap the various parts of the line with CDATA. Sort of messy. Another way I thought would be just call a JavaScript function passing the necessary params and then document.write the table out, but it sounds like another messy way.

 
Old January 28th, 2004, 07:07 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If you set the indent to no but force new lines etc. in the top you should be okay. How do the users view the meta parts, if just a text editor then use
Code:
<xsl:text>#x0a;</xsl:text>
to put a line feed in.

Joe (MVP - xml)
 
Old January 28th, 2004, 03:30 PM
Authorized User
 
Join Date: Jan 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Joe. I will have to consider setting indent=no if this problem creeps in other places. For now, I have a whole lot of inter-company exchanged meta data, so I went with the CDATA which looks something like

Code:
<xsl:template name="output-td">
    <xsl:param name="..." select="..."/>  
    <xsl:text disable-output-escaping="yes"><![CDATA[<td><img ]]></xsl:text>
    <xsl:value-of select="$..."/>
    <xsl:text disable-output-escaping="yes"><![CDATA[.../></td>]]></xsl:text>
</xsl:template>
Thank you for your response.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Change data of <TD> austinf Javascript 3 July 28th, 2006 05:32 AM
Fixing <TD> size. rupen HTML Code Clinic 4 April 28th, 2006 07:41 AM
change <td> value onClick crmpicco Javascript How-To 2 August 23rd, 2005 07:31 AM
XML into <td> crmpicco Classic ASP Basics 4 February 11th, 2005 09:57 AM
using variables within <td> tags handyman Javascript How-To 3 June 15th, 2004 11:18 PM





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