Solved

XSL & Space delimited entries

Posted on 2002-06-03
4
188 Views
Last Modified: 2012-05-04
I'm trying to format the output from an XSL transformation with a space between the two fields without any luck.

The following spits out text as indicated:

<xsl:for-each select="FileText/TLine">
<tr><td><pre>
<xsl:value-of select="TimeIndex"/>
<xsl:value-of select="TText"/>
<pre></td></tr>
</xsl:for-each>

12345Here's the text from this line

(where the TimeIndex=12345 & the TText=Here's the text from this line )

what I want is:
12345    Here's the text from this line

Is there any way in the XSL file to force spaces? If I put any character OTHER than spaces between the two fields it displays correctly.

<xsl:value-of select="TimeIndex"/>
:
<xsl:value-of select="TText"/>

Gives me:
12345:    Here's the text from this line

If I just put in several spaces, the output overwrites itself.

I've tried <pre>, etc. but no luck.

I'll bump the points up based on difficulty, but it seems like this should be relatively straight forward. I don't care about browser compatibility - it'll be IE only.

Thanks.

0
Comment
Question by:carpbyte
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 23

Expert Comment

by:b1xml2
ID: 7052583
<xsl:for-each select="FileText/TLine">
<tr>
<td>
<xsl:value-of select="concat(TimeIndex,' ',TText)"/>
</td>
</tr>
</xsl:for-each>

PS: You are right, this is a simple question. And the answer, is not IE-specific if it is XSLT.
0
 

Author Comment

by:carpbyte
ID: 7054148
This makes perfect sense, however I'm getting an error - "unknown method" but this may have to do with the rest of the XSL. Forgive my ignorance - I'm not new to programming but definitely new to XML.

Clarification appreciated & the points are yours :)

Thanks.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
      <xsl:for-each select="FileText/TLine">
        <tr>
     <td>
     <xsl:value-of select="concat(TimeIndex, '',TText)"/>
        </td>
     </tr>
     </xsl:for-each>

</body>
</html>
</xsl:template>
</xsl:stylesheet>

0
 
LVL 23

Accepted Solution

by:
b1xml2 earned 50 total points
ID: 7054262
that because of the namespace which is XSL and not XSLT.

XSLT Document
==============
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" indent="yes" />
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="FileText/TLine">
<tr>
<td>
<xsl:value-of select="concat(TimeIndex,' ',TText)"/>
</td>
</tr>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

with XSL that you are using:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="FileText/TLine">
<tr>
<td>
<!--on one single line-->
<xsl:value-of select="TimeIndex" /><xsl:entity-ref name="nbsp" /><xsl:value-of select="TText"/>
</td>
</tr>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
0
 

Author Comment

by:carpbyte
ID: 7054290
I figured I didn't give you the full story on the rest of the document.

Works perfectly!

Thank you very much.

Carp.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question