xsl-list
[Top] [All Lists]

Re: need help outputing summary of head elements

2005-09-19 05:13:05


<xsl:variable name="strRoman" as="xs:string">I. II.
III. IV. V. VI. VII. VIII. IX. X. XI. XII. XIII. XIV.
XV.</xsl:variable>

there's no need to make one big string and then have to keep checking
with contains and substring before, just make a list of strings

<xsl:variable name="strRoman" as="xs:string*" select="('I.', 'II.',
'III.', 'IV.', 'V.', 'VI.', 'VII.', 'VIII.', 'IX.', 'X.', 'XI.', 'XII.', 
'XIII.', 'XIV.'
)"/>

or simpler,


<xsl:function name="num:roman" as="xs:string">
  <xsl:param name="value" as="xs:integer"/>
  <xsl:number value="$value" format="I."/>
</xsl:function>


<xsl:variable name="strRoman" as="xs:string*"
  select="for $i in (1 to 19) return num:roman($i)"/>

It's difficult to follow the logic of your stylesheet without seeing the
input format, but from your descritption I think you just want something
like the following to seelct all the head eleemnts whose first word is a
roman numeral, then just test that position() != last() to insert the
separator.


<xsl:for-each select="$ParentInfo//div/head[substring-before(.,'')=$strRoman]">
do something with this head
<xsl:if test="position() != last()"> - </xsl:if>
</xsl:for-each>


David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--