XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1123)
- Stylus Studio Technical Forum (13809)
-> - Bug: Adding a scenario to an X... (1)
-> - Bug: Bug reporting outputs an ... (1)
-> - Tradacoms Invoice 9 Batch Quer... (1)
-> - problem with the product regis... (1)
-> + Help: Documentation... ends in... (2)
-> + How to install LIBxml2 (2)
-> - line numbers in validator outp... (1)
-> + Sharing Viollation in Stylus v... (5)
-> - support for asp.net in stylus... (1)
-> + how to use the latest java xml... (2)
-> - how to show xsd element relate... (1)
-> - Testing Stylus in a secure env... (1)
-> + How do you remove linemarkings... (3)
-> - Bug: Comment / Uncomment via C... (1)
-> + Setting escape (release) chara... (2)
-> + Xalan processor not showing up (2)
-> + Is there a keyboard shortcut t... (3)
-> - Modifying reports outside of S... (1)
-> + Run ALL Scenarios? (2)
-> + predefined macros ${ (4)
-> - TRADACOMS - EDI (1)
-> + SUM not working (3)
-> - Large xml file handling gives ... (1)
-> + 2011 Enterprise code folding f... (9)
-> + custom xml converter (3)
-> - Start Excel feter the mapping ... (1)
-> + Uninstall (2)
-> + xpath to compare two values fr... (2)
-> - xpath to compare two values fr... (1)
-> + SS2011 cannot save XML files u... (3)
-> + SS 2011 Enterprise saying 2010... (2)
-> + How to change the way whitespa... (7)
-> + Updating Relational Data Using... (4)
-> - Contract Stylus Studio help. ... (1)
-> + UTF_8 characters not displayed (6)
-> + Problem XSL to PDF ( dont reco... (2)
-> + HIPAA EDI - Looping question (4)
-> - HIPAA EDI - Looping question (1)
-> + Does XML Report support column... (2)
-> + Limited choice of XSL elements... (2)
-> + Single Source Publishing? (3)
-> - Stylus Stodio License (1)
-> - Stylus Stodio License (1)
-> + relax ng (3)
-> + having problem converting csv ... (8)
-> + error when selecting items fro... (2)
-> + CSV File to XML (3)
-> + Software registration - How to... (4)
-> - Software registration - How to... (1)
-> + .Net Saxon not supported by th... (2)
-> + How do I extend the Evaluation... (2)
-> + dst file (4)
-> + Flat File Custom XML conversio... (4)
-> + converting ascii file to xml f... (2)
-> + Evaluation Copy of Stylus Stud... (8)
-> + Batch process for soap (4)
-> + Strange error when running gen... (5)
-> + Merge Files (2)
-> + Convert cvs to XML (2)
-> + Stylus studio 2010 crashes in ... (5)
-> + excel to text (2)
-> + licence key? (2)
-> + JVM Heap error (4)
-> + How Do I clean TXT File? (2)
-> + SS Web Service Call Tester Pay... (3)
-> - SS Web Service Call Tester Mic... (1)
-> + Error in Stylus Studio - canno... (2)
-> + Saxon Assign (2)
-> - License Authentication Failed (1)
-> + Stylus Studio 2007 Download (2)
-> + EDI to XML validation (2)
-> + Reports: can't remove "undead"... (3)
-> + Document Wizard Incomplete (6)
-> + Opening xml converter (4)
-> + Node depth limit with MySQL? (5)
-> + Basics (2)
-> - Node depth limit with MySQL? (1)
-> + Creating an XML Schema from a ... (4)
-> - Issue with XSD (1)
-> + XSL-FO and Apache FOP (2)
-> + How Come Stylus Studio Fails T... (6)
-> + no suitable driver (8)
-> + 211,19: no declaration found f... (6)
-> - Validate HEX (1)
-> + Crashing when connected to dat... (3)
-> - Interface with quickbooks (1)
-> - CDATA control (1)
-> + [resolved] Namespace (and pref... (5)
-> - Hiding and Revealing Child Nod... (1)
-> + Cannot see values in Watch whe... (4)
-> - Help with CSV to XML and Regio... (1)
-> + How do I verify "opt=yes" URI ... (4)
-> - Stylus Studio claims xsd is in... (1)
-> + Can a generated XSD be used in... (4)
-> + I am not a developer I'm just ... (2)
-> + Stylus crash when deleting dat... (6)
-> - Preserving Structure (1)
-> - Preserving Structure (1)
-> - HL7 ORU group tags (1)
-> + Fixed Length Record Layout to ... (2)
-- Previous [181-200] [201-220] [221-240] Next
+ Website Feedback (243)
+ XSLT Help and Discussion (7447)
+ XQuery Help and Discussion (1861)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (361)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Shane McRobertsSubject: Tags not getting closed when generating HTML from XSLT
Author: Shane McRoberts
Date: 27 Sep 2005 12:09 PM
I'm trying to generate HTML from XML using XSLT, and I'm having trouble doing the simplest thing. For some reason my tags aren't getting closed for empty tags.

This XSL file:
================
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<head>
</head>
<body>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
=======================
generates this output file:
=======================
<html><head><META http-equiv="Content-Type" content="text/html"></head><body></body></html>
=======================

Note that the closing / is missing from the META tag. I've tried it with the built-in processor and with Saxon (I ran into this on a 2.0 stylesheet, but it doesn't seem to matter). If you try inserting a <link rel="stylesheet"/> element, the same thing happens. In fact none of my empty tags are terminated.

What am I doing wrong?

Thanks,

Shane


Documenttest(1).xslt
sample xslt with link element

Postnext
Alberto MassariSubject: Tags not getting closed when generating HTML from XSLT
Author: Alberto Massari
Date: 27 Sep 2005 03:01 PM
Hi Shane,
your stylesheet is missing the xsl:output instruction, so it is assumed to generate an HTML page (because the root node is <html>).
According to the XSLT specs, "the html output method should not output an end-tag for empty elements. For HTML 4.0, the empty elements are area, base, basefont, br, col, frame, hr, img, input, isindex, link, meta and param. For example, an element written as <br/> or <br></br> in the stylesheet should be output as <br>."
If you want the XSLT to generate well-formed XML you should add the instruction <xsl:output method="xml"/> right after the <xsl:stylesheet> instruction.

Hope this helps,
Alberto

Postnext
Shane McRobertsSubject: Tags not getting closed when generating HTML from XSLT
Author: Shane McRoberts
Date: 28 Sep 2005 12:30 AM
Thanks Alberto. It *does* work if I use method="xml", but I don't understand why it doesn't work with method="xhtml" (that's what I originally started with before scaling back to try to narrow the problem). It's not xhtml if it's not valid or well-formed xml, right?

Cheers,

Shane

Postnext
Shane McRobertsSubject: Tags not getting closed when generating HTML from XSLT
Author: Shane McRoberts
Date: 28 Sep 2005 12:37 AM
One other side note. Isn't it weird that output method=xhtml causes the processor to emit a META tag rather than meta?

Postnext
Ivan PedruzziSubject: Tags not getting closed when generating HTML from XSLT
Author: Ivan Pedruzzi
Date: 28 Sep 2005 12:48 AM
xhtml method is only supported by XSLT 2.0.

XSLT 1.0 supports text, xml or html


Ivan Pedruzzi
Stylus Studio Team

Postnext
Shane McRobertsSubject: Tags not getting closed when generating HTML from XSLT
Author: Shane McRoberts
Date: 28 Sep 2005 05:23 PM
Originally Posted: 28 Sep 2005 04:28 PM
>xhtml method is only supported<br> >by XSLT 2.0.<br> <br> Yes, I realize that. And when I use it I get the same results--open tags and upper case META. If simply changing the "1.0" to "2.0" and using Saxon 8.4 isn't sufficient to make the processor use XSLT 2.0, then that might be part of my problem.

Postnext
Tony LavinioSubject: Tags not getting closed when generating HTML from XSLT
Author: Tony Lavinio
Date: 12 Oct 2005 12:17 AM
We have identified the trouble with the XSLT 2.0 xhtml output method.
The next release will resolve this.

Posttop
Shane McRobertsSubject: Tags not getting closed when generating HTML from XSLT
Author: Shane McRoberts
Date: 21 Oct 2005 02:45 PM
Originally Posted: 21 Oct 2005 12:23 PM
you're welcome

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.