Jump to content

<br/> in <th> a problem -- new bee


Guest depandi
 Share

Recommended Posts

Guest depandi

Hi all,I am stuck at a possibly very simple problem. here it is..I have an HTML file for which I am writing a style sheet to produce output in text format. (output method = text)file is essentially an html file, but I save it as .xml (as html used is xml complient.. i.e xhtml? )part of the file looks something like<table><tr><th>first<br/>col</th></tr><tr><th>second<br/>col</th></tr><tr><td>stuff1</td></tr><tr><td>more stuff</td></tr></table>obviously in html you will see..first secondcol colbut in text created from running my style sheet, i want to showfirst col second colBasically, I wanto replace </br> encounter in my xml file with a space when I show output of <th> in text.When I try <xsl:value-of select"."/> (where current node is <th>) it displays "firstcol" -- i.e no space between "first" and "col". Is there any way you can give me a quick hint on how to show "first col" (with a space)? I will appreciate it.Please note, that this hase to be done in a particular way. Since, I print a bunch of <tr> in my table, I first calculate the on <th> or <td> with the longest size. then each <th> or <td> that is smaller than that, I add empty spaces at the end of it.here's the code for that...at this point i'm in a table...<xsl:for-each select="tr> <xsl:for-each select="th"> <xsl:choose> <xsl:when test="position()=1"> <xsl:value-of select="substring(concat(., $pad), 1, $col1max)" /> <xsl:text> | </xsl:text> </xsl:when> <xsl:when test="position()=2"> <xsl:value-of select="substring(concat(., $pad), 1, $col2max)" /> <xsl:text> | </xsl:text> </xsl:when>... and so forth </xsl:choose> </xsl:for-each></xsl:for-each>$pad has bunch of space. just to pad strings that are smaller than $col1max (incase of column 1). $col1max has the length of the longest string in col 1.This means, it is optimal for me to know where <br/> occurs in <th>, so I can print some text of <th>, then space instead of </br> and then the rest of the text of <th>.If it is confusing, please ask me a question. I will really appreciate your response.thanks,dp

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...