xsl-list
[Top] [All Lists]

Splitting Node Output CORRECTED

2003-01-24 09:48:43
Sorry. Ignore my last message. It had an erroneous paragraph.

I want to take this form element:
<BlAH>a brown dog jumped over a lazy fox who cares</BLAH>

and put into a table that's aligned like this:

<TR><TD colspan="2">a brown dog jumped over a</TD></TR>
<TR><TD>lazy fox who cares</TD><TD></TD></TR>

On my own I figured out how to do something like this:

<xsl:variable name="getTotalChars">
                <xsl:value-of select="string-length(.)" />
</xsl:variable>

<xsl:variable name="getLeftChars">
                <xsl:value-of select="($getTotalChars)-20" />
</xsl:variable>

<xsl:variable name="getCharDivision">
                <xsl:value-of select="($getLeftChars mod 25)" />
</xsl:variable>

<xsl:variable name="getLineDifference">
                <xsl:value-of select="(25 - $getCharDivision)" />
</xsl:variable>

<xsl:variable name="getNewAbove">
                <xsl:value-of select="($getLeftChars + $getLineDifference)" />
</xsl:variable>

<xsl:variable name="getWhatNew">
                <xsl:value-of select="substring(.,$getNewAbove,1)" />
</xsl:variable>

<TR><TD colspan="2"><xsl:value-of select="substring(.,0,$getNewAbove)" 
/></TD></TR>
<TR><TD><xsl:value-of select="substring(.,$getNewAbove)" /></TD><TD></TD></TR>

This is MOSTLY working. I'm not sure if it's the effecient right way to do it, 
but it was the best I could manage without outside assitance. Here's the 
problem, it returns this:

<TR><TD colspan="2">a brown dog jumped over a l</TD></TR>
<TR><TD>azy fox who cares</TD><TD></TD></TR>

So I need some way to test the character at the position $getNewAbove. If it's 
an empty space, then life is good. However if it is a character, I need to 
reduce the value of $getNewAbove by one, so that the word we've landed in the 
middle of will rag down into the next row.

Does this make sense? Do you have any suggestions?



heath deforrest allison
"Arrowed!"




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


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



<Prev in Thread] Current Thread [Next in Thread>
  • Splitting Node Output CORRECTED, HEATH ALLISON <=