XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Sharry StowellSubject: XSL Looping
Author: Sharry Stowell
Date: 28 Mar 2006 07:23 PM
Hi, I want to loop through a string. Say I have a variable with 15 characters in length.

var1 = ab-defghijklmno

I want to output it in a table:

<table>
<tr>
<td>a</td>
<td>b</td>
<td bgcolor="black">&nbsp;</td>
<td>e</td>
etc

I want it to loop through the string, if it comes across a '-' character write a different td output. Sounds simple, but I cannot do it! Any help much appreciated! Thanks


DocumentdisplayGrid.xsl
XSL File

Unknownstage1.xml
XML file

Postnext
Minollo I.Subject: XSL Looping
Author: Minollo I.
Date: 28 Mar 2006 08:32 PM
Something that may be useful is...

<xsl:template match="/">
<table>
<tr>
<xsl:call-template name="explodeString">
<xsl:with-param name="txt" select="'ab-defg'"/>
</xsl:call-template>
</tr>
</table>
</xsl:template>

<xsl:template name="explodeString">
<xsl:param name="txt"/>
<xsl:param name="pos" select="1"/>

<xsl:choose>
<xsl:when test="substring($txt, $pos, 1) = '-'">
<td>something special</td>
</xsl:when>
<xsl:otherwise>
<td>
<xsl:value-of select="substring($txt, $pos, 1)"/>
</td>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$pos &lt; string-length($txt)">
<xsl:call-template name="explodeString">
<xsl:with-param name="txt" select="$txt"/>
<xsl:with-param name="pos" select="$pos+1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

Postnext
Sharry StowellSubject: XSL Looping
Author: Sharry Stowell
Date: 29 Mar 2006 08:09 AM
Helpful as always, Minollo, thanks :)

Postnext
Sharry StowellSubject: XSL Looping
Author: Sharry Stowell
Date: 30 Mar 2006 02:35 PM
Using the same files above, esp .xml

I want to output a number in the top left hand corner (like a crossword), eg,
1 Across (4) = 'Read me', refers to a grid location where a little 1 would show in that location:

SUPPOSED TO BE PART OF TOP-LEFT OF CROSSWORD
------------------------------------------------------
1 | | | |\\\\\\\|2 |
| | | |\\\\\\\| |
B | O | O | K |\\\\\\\| |
| | | |\\\\\\\| |
-------------------------------------------------------

See where the 1 & 2 are. I need to create them, I have a 15 by 15 grid, each lines is displayed by a different rowVariable (created by substringing a 225 length allAnswer variable every 15 characters).

Is there XPATH/XSL expressions, that would generate these please?

Any help would be much appreciated, thank you.

Postnext
Sharry StowellSubject: XSL Looping
Author: Sharry Stowell
Date: 30 Mar 2006 02:41 PM
Messed up a bit, please see here:
http://img77.imageshack.us/img77/1817/crosswordoutput3fq.jpg

Posttop
Minollo I.Subject: XSL Looping
Author: Minollo I.
Date: 30 Mar 2006 02:44 PM
Sorry; general XSLT questions are better asked (and answered) on the xsl-list at mulberrytech.com

Thanks,
Minollo

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.