Subject: Use of variables From: Benjamin Ryan <ben.ryan@xxxxxxxxxxxxxxxx> Date: Tue, 04 Jul 2000 18:36:01 +0100 |
Hi, I have the following stylesheet, <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" indent="yes" /> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="author"> <xsl:variable name="ridsval" select="@rids" /> <xsl:variable name="ridval" select="substring-after('aff',$ridsval)" /> <xsl:message><xsl:value-of select="$ridsval" /></xsl:message> <xsl:message><xsl:value-of select="$ridval" /></xsl:message> <xsl:element name="strong"><xsl:value-of select="$ridval" /></xsl:element> <!--<xsl:element name="strong"> <xsl:attribute name="{$ridval}">RID VAL</xsl:attribute> </xsl:element>--> <xsl:element name="strong"> <xsl:attribute name="{$ridsval}">RIDS VAL</xsl:attribute> </xsl:element> </xsl:template> </xsl:stylesheet> processing the following the following xml doc (the relevant bit) ......... <author rids="aff1" role="corres"> <name-cpn type="forename">Loraine</name-cpn> <name-cpn type="family">Day</name-cpn> </author> ......... The first xsl:message produces the desired result aff1 The second produces nothing (empty node set?) The commented xsl:element gives the following error Error while applying stylesheet At xsl:attribute on line 17 of file:/D:/work/xsl/string-manip.xsl: Invalid attribute name [] I am using Saxon 5.3.2 on NT Once I have cleared up this problem I would like to be able to construct variable values using predicates with regexs e.g. sort of <xsl:template match="author"> <xsl:variable name="ridsval" select="@rids[(letter+ digit+)]" /> does anybody know if this is possiblke or am I going in the wrong direction? any help would be appreciated. Regards, Ben -- -------------------------- Dr Benjamin Ryan H. Charlesworth & Co. Ltd www.charlesworth.com -------------------------- XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Abstract Interpretation of XSLT, Joe English | Thread | Re: Use of variables, David Carlisle |
Re: Abstract Interpretation of XSLT, Joe English | Date | Re: Returning from a call-template , David Carlisle |
Month |