xsl-list
[Top] [All Lists]

RE: Variable question: capture and increase value

2002-09-24 09:05:48
Try 

<xsl:attribute name="CT">
  <xsl:value-of select="count(preceding::*[(_at_)CT=current()/@CT])+1"/>
</xsl:attribute>

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Mike Ferrando
Sent: 24 September 2002 14:33
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Variable question: capture and increase value


Dear Friends,
I am attempting to count like values and add an increasing 
value to the string. However, I am having a mental block and 
cannot seem to figure out how to do this.

I am trying to do this to the attribute @CT (below).

Anyone have any suggestions?

Sincerely,
Mike Ferrando
Washington, DC

Input: ===
<PROGRAMS ID="C1002" CTS="2-43">
  <C4 PS="1"><D4 CT="2">California</D4>
    <C5 PS="1"><D5 CT="2">Oakland</D5>
      <C6 PS="1"><D6 CT="2">Methody Meetin House</D6></C6>
      <C6 PS="2"><D6 CT="2">Unitarian Church</D6></C6></C5>
    <C5 PS="2"><D5 CT="2">San Francisco</D5>
      <C6 PS="3"><D6 CT="2">First Congregational Church</D6></C6>
      <C6 PS="4"><D6 CT="2">Temple Emanu-el</D6></C6></C5></C4>
  <C4 PS="2"><D4 CT="3">Colorado</D4>
    <C5 PS="3"><D5 CT="3">Denver</D5>
      <C6 PS="5"><D6 CT="3">Saint John's Cathedral</D6></C6></C5></C4>
  <C4 PS="3"><D4 CT="4">Connecticut</D4>
    <C5 PS="4"><D5 CT="4">Greenwich</D5>
      <C6 PS="6"><D6 CT="4">Christ Church</D6></C6></C5></C4>
  <C4 PS="5"><D4 CT="6">Illinois</D4>
    <C5 PS="18"><D5 CT="6">Chicago</D5>
      <C6 PS="28"><D6 CT="OV 3">Apollo Musical Club</D6></C6>
      <C6 PS="29"><D6 CT="6">Auditorium</D6></C6>
      <C6 PS="30"><D6 CT="7">Central Music Hall</D6></C6>
      <C6 PS="31"><D6 CT="7">First Congregational Church</D6></C6>
      <C6 PS="32"><D6 CT="43">First Methodist Episcopal 
Church</D6></C6>
      <C6 PS="33"><D6 CT="43">First Presbyterian Church</D6></C6>
      <C6 PS="34"><D6 CT="43">Hershey Music Hall</D6></C6>
      <C6 PS="35"><D6 CT="7">McCormick's Hall</D6></C6>
      <C6 PS="36"><D6 CT="7">Orchestra Hall</D6></C6>
      <C6 PS="37"><D6 CT="8">Trinity Church</D6></C6>
      <C6 PS="38"><D6 CT="8">Unity Church</D6></C6>
      <C6 PS="39"><D6 CT="8">World's Columbian 
Exposition</D6></C6></C5></C4> </PROGRAMS>


Output: === (desired)
<PROGRAMS ID="C1002" CTS="2-43">
  <C4 PS="1"><D4 CT="2/1">California</D4>
    <C5 PS="1"><D5 CT="2/2">Oakland</D5>
      <C6 PS="1"><D6 CT="2/3">Methody Meetin House</D6></C6>
      <C6 PS="2"><D6 CT="2/4">Unitarian Church</D6></C6></C5>
    <C5 PS="2"><D5 CT="2/5">San Francisco</D5>
      <C6 PS="3"><D6 CT="2/6">First Congregational Church</D6></C6>
      <C6 PS="4"><D6 CT="2/7">Temple Emanu-el</D6></C6></C5></C4>
  <C4 PS="2"><D4 CT="3/1">Colorado</D4>
    <C5 PS="3"><D5 CT="3/2">Denver</D5>
      <C6 PS="5"><D6 CT="3/3">Saint John's 
Cathedral</D6></C6></C5></C4>
  <C4 PS="3"><D4 CT="4/1">Connecticut</D4>
    <C5 PS="4"><D5 CT="4/2">Greenwich</D5>
      <C6 PS="6"><D6 CT="4/3">Christ Church</D6></C6></C5></C4>
  <C4 PS="5"><D4 CT="6/1">Illinois</D4>
    <C5 PS="18"><D5 CT="6/2">Chicago</D5>
      <C6 PS="28"><D6 CT="OV 3">Apollo Musical Club</D6></C6>
      <C6 PS="29"><D6 CT="6/3">Auditorium</D6></C6>
      <C6 PS="30"><D6 CT="7/1">Central Music Hall</D6></C6>
      <C6 PS="31"><D6 CT="7/2">First Congregational Church</D6></C6>
      <C6 PS="32"><D6 CT="43/1">First Methodist Episcopal 
Church</D6></C6>
      <C6 PS="33"><D6 CT="43/2">First Presbyterian Church</D6></C6>
      <C6 PS="34"><D6 CT="43/3">Hershey Music Hall</D6></C6>
      <C6 PS="35"><D6 CT="7/3">McCormick's Hall</D6></C6>
      <C6 PS="36"><D6 CT="7/4">Orchestra Hall</D6></C6>
      <C6 PS="37"><D6 CT="8/1">Trinity Church</D6></C6>
      <C6 PS="38"><D6 CT="8/2">Unity Church</D6></C6>
      <C6 PS="39"><D6 CT="8/3">World's Columbian 
Exposition</D6></C6></C5></C4> </PROGRAMS>



__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

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



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