Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

HTML and XSLT questions

  • 09-12-2007 06:25PM
    #1
    Registered Users, Registered Users 2 Posts: 1,821 ✭✭✭


    Hey I got some quick questions on HTML and XSLT.

    Techincally is using <br /> in HTML (XHTML form) considered bad practice or technically wrong? Should <br> be used when considering a html break tag (same goes for the likes of input).

    My question in regards to XSLT is this:

    If you do this in the tbody tags of a table in the body of html
    	   <xsl:for-each select="./catalogue/cars/car">
    	          <tr>
    	          <td><xsl:value-of select="carID" /></td>
    	          <td><xsl:value-of select="typeID" /></td> 
    	          <td><xsl:value-of select="age" /></td> 
    	          <td><xsl:value-of select="milesOnClock" /></td> 
    		  <td><xsl:value-of select="price" /></td> 
    	          </tr>
    	     </xsl:for-each>
    

    vs
    in tbody
    <xsl:apply-templates select="./catalogue/carTypes/carType" /> 
    
    and this outside the closing html tag
      <xsl:template match="carType"><tr>
      <td><xsl:value-of select="./typeID" /></td>
      <td><xsl:value-of select="./typeName" /></td>
      <td><xsl:value-of select="./engineSize" /></td>
      <td><xsl:value-of select="./numberOfDoors" /></td>
      </tr>
      </xsl:template>
    

    which would be better practice/deemed more correct or efficient?
    I have an exam in this tomorrow and the lecture can be slightly pedantic about these things :p

    The 2 last quotes are from the same document


Comments

  • Closed Accounts Posts: 867 ✭✭✭l3rian


    according to my firefox xhtml plugin <br /> is correct


  • Moderators, Science, Health & Environment Moderators Posts: 10,093 Mod ✭✭✭✭marco_polo


    <br /> is the correct version of the tag in XHTML as all tags must be closed off properly. The <br> tag is a older HTML tag which was not compatible with xml (ie there was no such thing as an </br> tag to make a HTML document well formed).


  • Registered Users, Registered Users 2 Posts: 1,127 ✭✭✭smcelhinney


    I've often mused over the intricacies of XHTML leniency for example
    <br/>
    
    is the XHTML standard, and validation will fail if its not closed. However
    <script language="javascript" type="text/javascript" src="..."></script>
    
    is an empty tag directive, but cannot be written as
    <script language="javascript" type="text/javascript" src="..." />
    
    Similarly
    <div class="clear" />
    
    wont work..

    Why, goddamit?! :mad:

    I tend to lose a lot of sleep over this.. </sarcasm>


Advertisement