Re: [xsl] XSL and "discontinuous" tags

Subject: Re: [xsl] XSL and "discontinuous" tags
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 14 Apr 2003 08:54:04 +0100
  I have an XML file that is somewhat unprofessional in design, because it
  does this (essentially)

  <quoteBegin/> this is a quote
  <p> with a paragraph inside </p>
  <p> and another, but the quote ends here <quoteEnd/> </p>

Actually quite a lot of professional designs do exactly that for marking
up information that does not naturally fit into into  hierarchy.


> I want to replace in the output the quoteBegin with a <font> tag, and
> the <quoteEnd> with a closing font tag (this is rendering to old HTML,
> so I am going to ignore, for the moment, the mal-formattedness of this

Of course if you put a <p inside a font elelemet it's _invalid_ HTML
(not that XSLT cares whether the output it generates is valid or not)

> However, the XSL parser won't let me do this "End tag 'font'
> does not match the start tag...". Is there a way around this in XSL?

As always the solution in XSLT is not to use the word "tag" which
usually implies that you are thinking of the linear XML document syntax
(which is the only place "tag" has meaning, and not with the tree view
of the document (which is the only think XSLT can act upon)


This is simply a grouping problem you want to group the nodes between 
quoteBegin and quoteEnd elements. See Jeni's site for grouping tips or
the current parallel thread
Re: [xsl] How to render TEI <div*>s with chapter-like  pagination?

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. 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


Current Thread