musicmancanora4 0 Light Poster

Hey guys with regards to <xsl:value-of select="Catalog/Product_Type/Name"> how would
i put that in a <h1> html tag which is defined in my css file.

<h1><xsl:value-of select="Catalog/Product_Type/Name"></h1>

i get errors in xalan when i do that? The results of the value-of select i want it
to be in a different font which is defined as <h1> in my css.

<xsl:template match="/">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>
			Phil's Bike Store
		</title>
<link href="Store.css" rel="stylesheet" type="text/css"/>
	</head>

	<body>
			
	<h1>Phil's Bike Store</h1>

	
	<p>
	<a href="#Road Bikes">Road Bikes</a>|
        <a href="#MTB Bikes">MTB Bikes</a>	
	<a href="#clothing">clothing</a>    |
	<a href="#Lights">Lights</a>        |
	<a href="#Parts and Accesories">Parts andAccesories</a>
	</p>
				
				
        <xsl:value-of select="Catalog/Product_Type/Name">
	</xsl:value-of>
				
				
	</body>
	</html>

		
	</xsl:template>

</xsl:stylesheet>

Dani AI

Generated

— you can absolutely put an XSL value into an <h1> and have the browser apply your CSS, but XSLT is XML: every element must be well formed and properly nested. The common Xalan error in this situation is caused by leaving the xsl:value-of tag unclosed or by breaking XML nesting (for example closing the h1 before closing the XSL element). Use either the empty-element form or explicitly close the xsl:value-of element so the tags nest correctly.

A few practical points that are often missed:

  • Confirm the XSL stylesheet element declares the XSL namespace and version; otherwise processors complain before they even get to your h1.
  • If you want an HTML output that the browser will style with your CSS, set an appropriate xsl:output (for plain HTML use method="html") so the serializer produces expected markup and the <link> in the head is emitted as written.
  • xsl:value-of returns the string value only. If the source Name node contains inline markup you need to preserve, use xsl:copy-of or xsl:apply-templates instead.

Quick troubleshooting checklist:

  • Run a strict XML validator or XSLT processor on the stylesheet to see the exact well-formedness error.
  • Simplify to a tiny test that outputs only the h1 containing your value to isolate the problem.
  • Inspect the processed output (View Source) to verify the h1 and the CSS link are present and correctly formed.

If the error persists, include the exact Xalan error text and a minimal reproducible XSLT (headers + relevant template) so responders can pinpoint the syntax issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.