Subject: Substring Misunderstood?
From: Dan Diebolt <dandiebolt@xxxxxxxxx>
Date: Fri, 4 May 2001 01:35:05 -0700 (PDT)
|
Substring has two forms:
substring(value,start)
substring(value,start,length)
Your usage of <<substring($idvalue,1)>> is grabbing the whole
string. Since $idval is just the content of <id>,
<xsl:variable name="idvalue" select="id"/>
what is the point of this processing?
Try the attached example and tie future questions to what a
realistic sample of the XML document you are processing looks
like.
Regards,
Dan
File:Samways4May2001.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="Samways4May2001.xsl"?>
<root>
<employee>
<id>1_1</id>
<name>Susan</name>
</employee>
<employee>
<id>1_2</id>
<name>Mary</name>
</employee>
</root>
File:Samways4May2001.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="root"/>
</xsl:template>
<xsl:template match="root">
<xsl:apply-templates select="employee"/>
</xsl:template>
<xsl:template match="employee">
<div align="left">
<xsl:value-of select="id"/> -
<xsl:value-of select="name"/> -
<xsl:value-of select="position()"/>
</div>
</xsl:template>
</xsl:stylesheet>
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|