xsl-list
[Top] [All Lists]

Re: Conditional processing for first and last of a set of elements

2004-03-10 05:51:25
At 2004-03-10 06:52 -0500, Munna D wrote:
I have a series of br elements scattered throughout an xhtml document. I would like to change the very first <br> to '<tr><td>', the intervening ones to '</td></tr><tr><td>', and the last one to '</td></tr>'

That is a syntactic transformation requirement, not an information transformation requirement, thus XSLT is not the appropriate tool for your stated needs.

I have got this template at teh moment
  <xsl:template match="//br[text()='LineNumberHolder']">

Such a template for an element node with the name "br" dictates the nodes (*NOT* the syntax) to construct in the result tree. The syntax representation for a node is well-formed XML and your strings of markup are not well-formed.

Your stated requirement is to manipulate angle brackets of the syntax, and that is expressly not in the scope of XSLT.

Please could someone tell me what I'm doing wrong?

You are using the wrong tool. XSLT is not designed to do arbitrary syntax manipulation. XSLT is designed to do node manipulation where a node can be represented as well-formed markup with appropriate start and end tags (not only one or the other).

I hope this helps.

.......................... Ken

--
US XSL training: Washington,DC March 15; San Francisco,CA March 22
World-wide on-site corporate, government & user group XML training
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


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