[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Use of variables

Subject: Use of variables
From: Benjamin Ryan <ben.ryan@xxxxxxxxxxxxxxxx>
Date: Tue, 04 Jul 2000 18:36:01 +0100
benjamin ryan
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.