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

Re: Non-well-formed HTML in XSL

Subject: Re: Non-well-formed HTML in XSL
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Tue, 16 Jul 2002 13:19:48 -0700 (PDT)
well formed html
--- Ryan Neil Gillespie <scoobie at UDel dot Edu> wrote:

> 
> Thanks a lot for the previous help. Template matching makes more
> sense
> now.
> 
> I would like to print HTML that will (eventually) be well-formed.
> However,
> the XSL to display it is not well-formed and thus I get an error.
> What
> I
> need is a way to tell XSL to disregard the non-well-formedness of the
> HTML
> I'm writing.
> 
> --------
> some.xsl
> --------
> 
> <table>
> 
>   <tr><td>
>     <xsl:attribute name="rowspan">
>       <xsl:value-of select="count(meet)"/>
>     </xsl:attribute>
> 
>       <xsl:value-of select="../instructor"/>
>   </td>
> 
>   <xsl:for-each select="meet">
> 
>     <xsl:if test="ancestor::node()[position() != 1]">
>       </tr><tr>   # this is the problem
>     </xsl:if>
> 
>     <td>some info</td>
> 
>   </xsl:for-each>
> 
>   </tr>
> 
> </table>
> 
> --------
> What I want the HTML to look like
> --------
> <table>
> 
>   <tr>
>     <td rowspan="2">Johnson</td>
>     <td>some info</td>
>   </tr>
>   <tr>
>     <td>some info</td>
>   </tr>
> 
>   <tr>
>     <td rowspan="2">Galbraith</td>
>     <td>some info</td>
>   </tr>
> 
> </table>
> 
> ---------
> sample XML input
> ---------
> 
>       <course>
>         <title>Early Childhood Development</title>
>         <subject>EDUC</subject>
>         <number>104</number>
>         <section>010</section>
>         <instructor>Phillips</instructor>
> 
>         <meets>
>           <meet>
>             <format>LEC</format>
>             <building>SMI</building>
>             <room>205</room>
>             <days>MWF</days>
>             <starts>1100</starts>
>             <ends>1230</ends>
>           </meet>
> 
> 
> _ryan


Hi Ryan,

You should never try to output non-well-formed xml (and this is
possible in 99.9999% of all cases).

In this particular case instead of:

<tr><td>
    <xsl:attribute name="rowspan">
      <xsl:value-of select="count(meet)"/>
    </xsl:attribute>

      <xsl:value-of select="../instructor"/>
  </td>

  <xsl:for-each select="meet">

    <xsl:if test="ancestor::node()[position() != 1]">
      </tr><tr>   # this is the problem
    </xsl:if>

    <td>some info</td>

  </xsl:for-each>

  </tr>

use:

<tr>
  <td>
    <xsl:attribute name="rowspan">
      <xsl:value-of select="count(meet)"/>
    </xsl:attribute>

      <xsl:value-of select="../instructor"/>
  </td>

  <xsl:apply-templates select="meet"/>


</tr>


In case you could explain what exactly you're trying to do, many people
on this list will be able to show a correct solution.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

 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.