Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Grasping Numbers

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have an xml page, i have written an xsl for it. in the xml page i have some elements called <bits> in this bits element again there may be 2 or 1 elements like this:<start> or <start></start><end></end>
there may be more sumber of start elements in the same bits elements, or more number of their combinations,
like:
1.<start>2</start><start>1</start>9<start></start>.
2.<start>24</start><end>15</end><start>12</start><end>10</end>.
3.<start>8</start><end>6</end><start>24</start>
4.<start>24</start><start>8</start><end>6</end>
5.<start>24</start><start>8</start><end>6</end><start>2</start>
like this there may be lot of combinations.
my xsl code for taking numbers in this is:
<xsl:for-each select="Bits/Start">
<xsl:variable name="actual_pos"><xsl:value-of select="position()"/>
</xsl:variable>
<xsl:variable name="start_val">
<xsl:value-of select="."/>
</xsl:variable>
<xsl:variable name="DStartEnd">
<xsl:choose>
<xsl:when test=" contains($start_val, '(' )">
<xsl:value-of select="substring-after($start_val, '(' )"/>:
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$start_val"/>:
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="../End[position()=$actual_pos]">
<xsl:variable name="end">
<xsl:value-of select="../End[position()=$actual_pos]"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($end, ')' )">
<xsl:value-of select="substring-before($end, ')')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$end"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$start_val"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="addElement2">
<xsl:with-param name="DStartEnd" select="$DStartEnd"/>
<xsl:with-param name="name" select="../../Field"/>
<xsl:with-param name="access" select="../../AccType"/>
<xsl:with-param name="DescLongName" select="../../Desc/LongName"/>
<xsl:with-param name="DescText" select="../../Desc/DescriptionText"/>
</xsl:call-template>
</xsl:for-each>
it is working for all the conditions except for the 4th and 5th conditions.
i found that it is due to, the first start element is looking for the end element, after the first start element if again start element is there, it is not taking care of the second start element but it is taking the end element of second start element.
so please give me an idea, how to do for the elements like 4th and 5th.
thanks.
srini.

Edit Comment:
Disabled smiles....;)
- madhav
[ September 05, 2003: Message edited by: Madhav Lakkapragada ]
 
A wop bop a lu bop a womp bam boom! Tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic