Need some help with meta keywords tag in XSMT

sinewave

Regular Member
Joined
Aug 25, 2007
Messages
463
Reaction score
640
Hi everyone,
Can anyone give me the dumbed-down version of how to generate a meta keywords tag from an XSLT file. I've been looking for almost 3 hours and am unable to understand what most of the online forums suggest.

I just want to hard code it for the time being.

HTML tags don't work on meta stuff generated from XSL.

Thanks in advance.
Best,
Sine

Edited because I can't seem to type. I meant "XSLT", not "XSMT"
 
Sorry for the bump, but no one has some advice with inserting metadata via an XSLT document?

Best,
Sine
 
Hi Sinewave,

I'm trying to understand what you are asking. Do you want to input into html page metatags generated from a xslt file? Spit out valid html from contents of a xslt doc.?

Chris
 
Sinewave,

Does this page help any? hxxp://weblogs.asp.net/cnagel/archive/2004/09/24/233765.aspx

Chris
 
Looking at the below from W3*Schools it seems like you can just add the head tag in with your meta. If someone sees that I am reading this wrong please tell me so I can not look silly in the future.

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">       <xsl:template match="/">
<html>
Add
Code:
<head>
<meta stuff>
</head>
Then continue with the rest
Code:
<body>
<h2>My CD Collection</h2> 
<xsl:apply-templates/> 
</body>
</html>
</xsl:template>       <xsl:template match="cd">
<p>
<xsl:apply-templates select="title"/> 
<xsl:apply-templates select="artist"/>
</p>
</xsl:template>       <xsl:template match="title">
Title: <span style="color:#ff0000">
<xsl:value-of select="."/></span>
<br />
</xsl:template>       <xsl:template match="artist">
Artist: <span style="color:#00ff00">
<xsl:value-of select="."/></span>
<br />
</xsl:template>       </xsl:stylesheet>
 
Totally understand XSLT can be confusing at first.
You can hard code the meta tag using &lt;xsl:element&gt; or plain &lt;xsl:text&gt; inside &lt;head&gt;.
Hope someone shares a working example to make it clearer!
 
Back
Top