Re: [xsl] need help outputing summary of head elements

Subject: Re: [xsl] need help outputing summary of head elements
From: UlyLee <ulyleeka@xxxxxxxxx>
Date: Mon, 19 Sep 2005 22:40:36 -0700 (PDT)
> <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)"/>

i used the former instead of the later, i'm having an
error on the for statement in select (not a valid
XPATH 2.0 expression).

> 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>

i can't use this because the head element is of mixed
content type and using head[substring-before(.,'
')=$strRoman] does not get all the head elements that
has a starting roman numeral identifier because of
cases like this one, <head><hi rend="bold">I.</hi>
Head 1</head>. thats why i'm assigning first a
variable to hold the <xsl:value-of select="."> and
then test the variable for occurences of roman
numerals.

here's a sample of my input file:

<art>
<complexarticle id="COM-00956" entry="A priori/a
posteriori" sortcode="10034" volume="1" page="0">
<pseudoarticle>
<articleentry>
<mainentry>A priori/a posteriori</mainentry>
<mainentry lang="en">A priori / a
posteriori</mainentry>
</articleentry>
<info><sumpara/></info>
<div>
<head><hi rend="bold">I.</hi> Head 1</head>
<p>Text</p>
<div>
<head><hi rend="bold">1.</hi></head>
<p>Text</p>
</div>
<div>
<head><hi rend="bold">2.</hi></head>
<p>Text</p>
</div>
</div>
<div>
<head><hi rend="bold">II.</hi></head>
<p>Text</p>
</div>
<contributorgroup><name normal="Willaschek,
Marcus">Marcus Willaschek</name></contributorgroup>
</pseudoarticle>
<pseudobiblio>
<bibliogroup>
<listbibl><p>Aristotle <hi rend="italic">An.
Post.</hi> 71b/72a</p></listbibl>
<listbibl><p>G.W. Leibniz, <hi rend="italic">Nouveaux
Essais</hi>, VI.2</p></listbibl>
</bibliogroup>
</pseudobiblio>
</complexarticle>
</art>

not all head elements with roman numeral occurs in the
first div there are some art that has a div with roman
situated deep into the structure.

I hope i these helps in giving light to my problem.

thanks,
UlyLee


		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

Current Thread