Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

HTML and XSLT questions

Options
  • 09-12-2007 7:25pm
    #1
    Registered Users 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,079 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 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