[xsl] generating id by calling template but how to use it at other places

Subject: [xsl] generating id by calling template but how to use it at other places
From: Jinesh Varia <jineshresearch@xxxxxxxxx>
Date: Wed, 5 Feb 2003 20:14:33 -0800 (PST)
Hello people, 

Please ignore the previous email this email contains
proper question without any typos

two unique problems:

My XML is
<publication pubid="0002">
<author>steve lawer</author>

I want my new XML as:
<publication pubid="0002">
<person perid="100000004"> <!-- new id generation -->
<personname>steve lawer</personname>
<pubper> <!-- publication-person intersection -->

My XSL is:
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
 <xsl:output method="xml" indent="yes"/>

<xsl:template match="publication">

<xsl:copy-of select="@*|*[not(self::author or
self::editor)]"/> <!-- this is just to cut the authors

<xsl:if test="author=not(.=preceding::author)"
><!-- this is so that we get unique author names:
Please comment on this #####1-->
        <xsl:apply-templates select="author">
<xsl:with-param name="temppubid" select="@pubid" />
<xsl:template match="author">
<xsl:param name="temppubid" />
<xsl:attribute name="perid">
 <xsl:call-template name="generate-author-id"> <!--
generating ids ####2-->
<xsl:value-of select="."/>
       <xsl:value-of select="$temppubid"/>
         <xsl:value-of select="???????????"/> <!- I
want to print the id at #####2 that I just created for
person element
over here. What should I use is this not
printing....how to print
the value. ####3-->


 <xsl:template name="generate-author-id">
  <xsl:variable name="last"
  <xsl:variable name="this"
  <xsl:variable name="temp"
select="concat('800000000',$last+$this)" />
select="substring($temp,string-length($temp)-9)" />
<!-- we just want 10-digit IDs -->

Please comment on ###1, ###3
I want to know what select statement should I use?
I thought using a 

<xsl:variable name="tempperid">
<xsl:call-template name="generate-author-id" />

and use $tempperid everywhere. But this does not work
since the XSL is a decraraltive language and the value
of the variable remains the same.
Thanks in advance

Jinesh Varia
Graduate Student, Information Systems
Pennsylvania State University
Email: jinesh@xxxxxxx
'Self is the author of its actions.'

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread