[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Getting all the values between empty elements

Subject: RE: [xsl] Getting all the values between empty elements
From: "Kyle Partridge" <kpartridge@xxxxxxxxxxxx>
Date: Mon, 5 Jan 2004 17:09:29 -0500

Err...you were right - way too optimistic of me.

I apologize!  I see what you are getting at with this solution, but I
gave far too little information, I'm afraid...and I can't seem to
translate what you've suggested into an application that will work for
my situation.

Here's a bit more information (that I am quite sure everyone is sick of
by now, but I can't quite get to the end of it):

<p style="Normal" tabs="0.2 1.2 2.7">
<tab/>A Few<tab/>Lime <c val="#0f0">Green</c><tab/>Octopii<br/>
<tab/><tab/><tab/>Or something far more sinister?<br/>

With some help from Ken and Andreas, and some of my own flailing about,
I came up with this XSL to do the "rows" of a table to format this:

<xsl:template match="ws:br" mode="rowcreate">
	<xsl:variable name="current-row" select="position()"/>
	<xsl:variable name="number-of-cells"
select="count(preceding-sibling::ws:tab) div $current-row"/>
	<xsl:variable name="lower-limit" select="($current-row - 1) *
	<xsl:variable name="upper-limit" select="$current-row *
		<xsl:for-each select="preceding-sibling::ws:tab">
			<xsl:variable name="tab-number"
			<xsl:if test="$tab-number>$lower-limit and
test="./preceding-sibling::node()[1][name()='br' or name()='tab']">
<xsl:value-of select="preceding-sibling::text()[1]"/>			

What I want to do is replace the <xsl:value-of
select="preceding-sibling::text()[1]"/> with an apply-templates on
everything between either a tab and another tab, or a br and a tab.  I
can't just loop through the preceding(or following) sibling tabs, or the
child of p tabs, because when I go through each "set" of tab-siblings, I
have to do different treatments to ensure that <br/> tags will end a
row.  That's what all that silly lower-limit and upper-limit business is


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

Current Thread