Generate proper META tag in HTML output?
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 88
- Joined: Wed Feb 11, 2015 11:25 pm
- Location: San Francisco, California USA
- Contact:
Generate proper META tag in HTML output?
------
Oxygen 17, XSLT transform with Saxon6.5.5 transformer.
I'm using a book's examples to get started with XSLT.
One of the examples is generating HTML output without a closing META tag.
■ When I open the HTML output in oXygen 17, oXygen informs me, element "title" not allowed here; expected the element end-tag.
■ If I simply use the editor to add a </meta> tag to the HTML by hand, the error is remedied.
I want to please learn the correct way to eliminate this sort of error.
The Source XML
The XSL
The HTML Output
I'm new to this so not sure what the correct way is to remedy this problem. I'm surprised that the process doesn't automatically add the </meta> tag if it's required(?)
Cheers & thanks for your help,
Riley
SFO
Oxygen 17, XSLT transform with Saxon6.5.5 transformer.
I'm using a book's examples to get started with XSLT.
One of the examples is generating HTML output without a closing META tag.
■ When I open the HTML output in oXygen 17, oXygen informs me, element "title" not allowed here; expected the element end-tag.
■ If I simply use the editor to add a </meta> tag to the HTML by hand, the error is remedied.
I want to please learn the correct way to eliminate this sort of error.
The Source XML
Code: Select all
<?xml version="1.0"?>
<message>You can use literal result elements in stylesheets.</message>
Code: Select all
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>HTML Output</title>
</head>
<body>
<p>
<xsl:apply-templates/>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- NOTE that imply adding a </meta> closing here eliminates the error -->
<title>HTML Output</title>
</head>
<body>
<p>You can use literal result elements in stylesheets.</p>
</body>
</html>>
Cheers & thanks for your help,
Riley
SFO
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Generate proper META tag in HTML output?
Hello,
Note that Oxygen doesn't validate HTML (SGML form), only XHTML (HTML in XML form).
Your meta tag is fine for HTML, so there is no problem there HTML-wise. It only needs to be closed for XHTML.
So the question is, what is the desired result, HTML or XHTML?
Regards,
Adrian
Note that Oxygen doesn't validate HTML (SGML form), only XHTML (HTML in XML form).
Your meta tag is fine for HTML, so there is no problem there HTML-wise. It only needs to be closed for XHTML.
So the question is, what is the desired result, HTML or XHTML?
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 88
- Joined: Wed Feb 11, 2015 11:25 pm
- Location: San Francisco, California USA
- Contact:
Re: Generate proper META tag in HTML output?
Adrian:
Thanks for the help.
I'm just guessing -- really. As I said, I'm just getting started running XSLT.
Thanks 'gain,
Riley
SFO
Thanks for the help.
I generally produce XHTML. So making an inferential leap, is the solution to modify the output method to say ="xhtml" ala?So the question is, what is the desired result, HTML or XHTML?
Code: Select all
<xsl:output method="xhtml" indent="yes"/>
Thanks 'gain,
Riley
SFO
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Generate proper META tag in HTML output?
Hi,
I'm afraid it's not that easy, because the XSL engine doesn't know about XHTML. You can see in the content completion list that for the method the possible values are 'xml', 'html' or 'text'. So, for XHTML you have to set the output method to 'xml':
The side effect is that the meta tag will disappear from the output (it's no longer implied). So, if you still want it there, you'll have to manually add it in the stylesheet, inside the 'head' element:
Regards,
Adrian
I'm afraid it's not that easy, because the XSL engine doesn't know about XHTML. You can see in the content completion list that for the method the possible values are 'xml', 'html' or 'text'. So, for XHTML you have to set the output method to 'xml':
Code: Select all
<xsl:output method="xml" indent="yes"/>
Code: Select all
<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>HTML Output</title>
</head>
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 88
- Joined: Wed Feb 11, 2015 11:25 pm
- Location: San Francisco, California USA
- Contact:
Re: Generate proper META tag in HTML output?
Thank so much, Adrian, for your time and patience! Riley, SFO
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service