HTML & XSLT Follow
I've raised this matter before, but I think I may have asked the question in the wrong way.
I use XSLT to generate XHTML output. I therefore have HTML within my XSLT files. PHPStorm currently highlights all the HTML tags with "Cannot resolve symbol" errors so I get a sea of red.
Here's an example file:
<!DOCTYPE xsl:stylesheet SYSTEM "../../config/entities.dtd">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="html"
version="1.0">
<xsl:import href="progressBar.xslt"/>
<xsl:output encoding="utf-8"
method="html"
omit-xml-declaration="yes"
indent="no"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
<!--
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ROOT
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<xsl:template match="ROOT">
<html>
<head>
<xsl:call-template name="head"/>
<title>&submitAd_title;</title>
</head>
<body>
<div >
<xsl:call-template name="header"/>
<h2 >&submitAd_title;</h2>
<xsl:call-template name="progressBar">
<xsl:with-param name="current" select="'&submitAd_progress_pics;'"/>
</xsl:call-template>
<xsl:apply-templates select="car"/>
<xsl:call-template name="footer"/>
</div>
<xsl:call-template name="scripts"/>
<xsl:call-template name="localScript"/>
</body>
</html>
</xsl:template>
Now PHPStorm is clever enough to work out that it should apply XML inspections, XPATH inspections, it even recognises Javascript within the code.
How do I get it to recognise the HTML? Do I need to define a namespace for the HTML?
Please sign in to leave a comment.
Hello Ted Ted,
What is the file type and PhpStorm version?
Thank you for feedback!
The file type is .xslt and the version is 2.1.1
I've also had no success in turning off the error tracking and code completion for these files.
I've cracked it.
My inclusion of my own entities at the top of the page had the impact of making my HTML invalid.
Yes, you figured this out correctly: IDEA doesn't like the presence of a DTD that doesn't declare the "foreign" elements.
Sascha