I have an XML page with the XSLT embedded in the file. I cannot have an external file for the XSLT in this application. Additionally I must reference the stylesheet in a way that the XML file's name can change. I can do this with...

<?xml-stylesheet type="text/xsl" href="#mySheet"?>

...where...

<xsl:template match="MyMainTag" name="mySheet">

...now this renders PERFECTLY in IE but dies in Firefox. Is there anything I can do to resolve this? I am more than willing to reformat the whole thing if need be.

Regards,

I would like to see your XML document with XSLT embedded which you master to perfectly render within IE.

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='#test'?>
<!DOCTYPE n1:target [
	<!ELEMENT xsl:value-of EMPTY>
<!ATTLIST xsl:value-of
	select CDATA #FIXED "n1:target/n1:title"
>
<!ELEMENT xsl:template ((html))>
<!ATTLIST xsl:template
	match CDATA #FIXED "/"
>
<!ELEMENT xsl:stylesheet ((xsl:output, xsl:template))>
<!ATTLIST xsl:stylesheet
	id CDATA #FIXED "test"
	version CDATA #FIXED "1.0"
	xmlns:n1 CDATA #FIXED "urn:asdf"
	xmlns:xsl CDATA #FIXED "http://www.w3.org/1999/XSL/Transform"
>
<!ELEMENT xsl:output EMPTY>
<!ATTLIST xsl:output
	method CDATA #FIXED "html"
>
<!ELEMENT title ((xsl:value-of))>
<!ELEMENT n1:title (#PCDATA)>
<!ELEMENT n1:target ((xsl:stylesheet, n1:title))>
<!ATTLIST n1:target
	xmlns:n1 CDATA #FIXED "urn:asdf"
>
<!ELEMENT html ((head, body))>
<!ELEMENT head ((title))>
<!ELEMENT h1 ((center))>
<!ELEMENT center ((xsl:value-of))>
<!ELEMENT body ((h1))>
]>
<n1:target xmlns:n1="urn:asdf">
	<xsl:stylesheet id="test" xmlns:n1="urn:asdf" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
		<xsl:output method="html"/>
		<xsl:template match="/">
			<html>
				<head>
					<title>
						<xsl:value-of select="n1:target/n1:title"/>
					</title>
				</head>
				<body>
					<h1>
						<center>
							<xsl:value-of select="n1:target/n1:title"/>
						</center>
					</h1>
				</body>
			</html>
		</xsl:template>
		</xsl:stylesheet>
	<n1:title>This is the title</n1:title>
</n1:target>

display browser

This is the title

well I tried your example - well "This is the title" is displayed but not as it is supposed to be. It should be centered. And the title of the document should not be "<xsl:value-of select=...>". Actually I get the same result with the following:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='#test'?>
<!DOCTYPE target [<!ATTLIST xsl:stylesheet id ID #REQUIRED>]>
<n1:target xmlns:n1="urn:asdf">
  <xsl:stylesheet id="test" xmlns:n1="urn:asdf" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"> 
    <xsl:output method="html"/>
    <xsl:template match="/">
      <html>
        <head>
          <title>
            <xsl:value-of select="n1:target/n1:title"/>
          </title>
        </head>
        <body>
          <h1>
            <center>
              <xsl:value-of select="n1:target/n1:title"/>
            </center>
          </h1>
        </body>
      </html>
    </xsl:template>
    <xsl:template match="xsl:stylesheet"/>
  </xsl:stylesheet>
  <n1:title>This is the title</n1:title>
</n1:target>

Edited 5 Years Ago by _gabe_: n/a

This article has been dead for over six months. Start a new discussion instead.