Jump to content

How do we display a "/" between data


faizal_md

Recommended Posts

Hi , I need to add "/" in between the display data. Can anyone help?here is my xml<?xml version="1.0" encoding="windows-1252"?><?xml-stylesheet type="text/xsl" href = "sample.xsl"?><subjectidentification> <######> <item>MALE </item> <item>FEMALE</item> <item>UNKNOWN</item> </######></subjectidentification> here is my xsl<?xml version="1.0" encoding="windows-1252"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Root template --><xsl:template match="/"><HTML><BODY><H4> SUBJECT INDENTIFICATION DATA </H4><TABLE ><TR><TD align="left">######:</TD> <xsl:for-each select="subjectidentification/######"> <xsl:for-each select="item"> <TD align="left"> <xsl:value-of select="."/> </TD> </xsl:for-each> </xsl:for-each></TR></TABLE ></TABLE></BODY></HTML></xsl:template></xsl:stylesheet>>My output should look like this SUBJECT INDENTIFICATION DATA ###### : MALE / FEMALE / UNKNOWN(Please note the "/" between male and female and unknown, how can we display "/" between the data dynamically, "/" should not apear before or after the last data.)Any help ?Thank you.

Link to comment
Share on other sites

Adding a simple <xsl:if> will do it:<TD align="left"><xsl:value-of select="."/><xsl:if test="position() != last()">/</xsl:if></TD>

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
×
×
  • Create New...