[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How to show distinct node values?

Subject: How to show distinct node values?
From: "Poort, J." <J.Poort@xxxxxxxxxxxx>
Date: Wed, 23 Jul 2003 16:44:45 +0200
rebellious subjects enemies to peace
Hello,
I'm using a big XML file and want to transform the data by XSL
I open the XML in IE 6.0 and say  href="r_and_j.xslt".
In r_and_j.xslt  I enter the XSL-commands.

The XML file contains the play Romeo and Juliet.
I want now to show in a table for each ACT and each SCENE the names of the SPEAKER 
and the number of LINES he has to speak.
Problemn is that I'm not able to show the distinct node values for the SPEAKER.
I'm able to count the lines for the SPEAKERS.
On your site I found solutions like
   <xsl:key  name="speakers"  match="SPEAKER" use="." />
or
<xsl:for-each  select="./SPEAKER[not(.=preceding::speaker)]"  />  
They don't work for me (at least I don't know how!)

Please advise,
Thanks,

Joek Poort

More info below:
I get :
			Speakers	number lines
ACT I 	SCENE I   	SAMPSON	10
			GREGORY	8
			SAMPSON	10
			GREGORY	8
			SAMPSON	10
			GREGORY	8
			SAMPSON	10
			GREGORY	8
			SAMPSON	10
			GREGORY	8
			SAMPSON	10
			GREGORY	8
			ABRAHAM	24
			BALTASAR	12
			ABRAHAM	24
			BALTASAR	12
			ABRAHAM	24
			BALTASAR	12
 Etc.....
					 
I would like to get something like:
	
			Speakers	number lines
ACT I 	SCENE I   	SAMPSON	10
			GREGORY	8
			ABRAHAM	24
			BALTASAR	12
			BENVOLIO	6
			TYBALT	6
			PRINCE	9
	SCENE ||	SAMPSON	3
			ROMEO	23
			JULIA		2
			Servant		4
					 

Small Part of the XML is
<?xml version="1.0" standalone="yes"?><?xml-stylesheet type="text/xsl" href="r_and_j.xslt"?>

<PLAY>
<TITLE>The Tragedy of Romeo and Juliet</TITLE>
<PLAYSUBT>ROMEO AND JULIET</PLAYSUBT>
<ACT><TITLE>ACT I</TITLE>
<SCENE><TITLE>SCENE I.  Verona. A public place.</TITLE>
<STAGEDIR>Enter SAMPSON and GREGORY, of the house of Capulet,
armed with swords and bucklers</STAGEDIR>
<SPEECH>
<SPEAKER>SAMPSON</SPEAKER>
<LINE>Gregory, o' my word, we'll not carry coals.</LINE>
</SPEECH>
<SPEECH>
<SPEAKER>GREGORY</SPEAKER>
<LINE>No, for then we should be colliers.</LINE>
</SPEECH>
<SPEECH>
<SPEAKER>SAMPSON</SPEAKER>
<LINE>I mean, an we be in choler, we'll draw.</LINE>
</SPEECH>
<SPEECH>
<SPEAKER>GREGORY</SPEAKER>
<LINE>Ay, while you live, draw your neck out o' the collar.</LINE>
</SPEECH>

<SPEECH>
<SPEAKER>SAMPSON</SPEAKER>
<LINE>'Tis all one, I will show myself a tyrant: when I</LINE>
<LINE>have fought with the men, I will be cruel with the</LINE>
<LINE>maids, and cut off their heads.</LINE>
</SPEECH>

<STAGEDIR>Enter ABRAHAM and BALTHASAR</STAGEDIR>

<SPEECH>
<SPEAKER>ABRAHAM</SPEAKER>
<LINE>Do you bite your thumb at us, sir?</LINE>
</SPEECH>

<SPEECH>
<SPEAKER>SAMPSON</SPEAKER>
<LINE>I do bite my thumb, sir.</LINE>
</SPEECH>

<SPEECH>
<SPEAKER>BENVOLIO</SPEAKER>
<LINE>Part, fools!</LINE>
<LINE>Put up your swords; you know not what you do.</LINE>
</SPEECH>
<STAGEDIR>Beats down their swords</STAGEDIR>
<STAGEDIR>Enter TYBALT</STAGEDIR>

<SPEECH>
<SPEAKER>TYBALT</SPEAKER>
<LINE>What, art thou drawn among these heartless hinds?</LINE>
<LINE>Turn thee, Benvolio, look upon thy death.</LINE>
</SPEECH>

<SPEECH>
<SPEAKER>BENVOLIO</SPEAKER>
<LINE>I do but keep the peace: put up thy sword,</LINE>
<LINE>Or manage it to part these men with me.</LINE>
</SPEECH>

<SPEECH>
<SPEAKER>TYBALT</SPEAKER>
<LINE>What, drawn, and talk of peace! I hate the word,</LINE>
<LINE>As I hate hell, all Montagues, and thee:</LINE>
<LINE>Have at thee, coward!</LINE>
</SPEECH>

<SPEECH>
<SPEAKER>PRINCE</SPEAKER>
<LINE>Rebellious subjects, enemies to peace,</LINE>
<LINE>Profaners of this neighbour-stained steel,--</LINE>
<LINE>Will they not hear? What, ho! you men, you beasts,</LINE>
<LINE>That quench the fire of your pernicious rage</LINE>
<LINE>With purple fountains issuing from your veins,</LINE>
<LINE>On pain of torture, from those bloody hands</LINE>
<LINE>Throw your mistemper'd weapons to the ground,</LINE>
<LINE>And hear the sentence of your moved prince.</LINE>
<LINE>Three civil brawls, bred of an airy word,</LINE>
<LINE>By thee, old Capulet, and Montague,</LINE>
<LINE>Have thrice disturb'd the quiet of our streets,</LINE>
<LINE>And made Verona's ancient citizens</LINE>
<LINE>Cast by their grave beseeming ornaments,</LINE>
<LINE>To wield old partisans, in hands as old,</LINE>
<LINE>Canker'd with peace, to part your canker'd hate:</LINE>
<LINE>If ever you disturb our streets again,</LINE>
</SPEECH>
</ACT>

</SCENE>



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.