Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 10th, 2004, 11:29 PM
Registered User
 
Join Date: Aug 2004
Location: islamabad, , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to insert <META> tag using XSLT on client?

Dear Reader

I am using the following procedure to insert <META> tag in .html. But I cannnot see the <meta> tag in VIEW -> SOURCE. Please help me how can I XSLT on client, to insert <META>. so I can see <META> tag in VIEW -> SOURCE?

Please help me in this regard. I will be thankful to you for this kindness. Thanking you in anticipation.
------------- Problem starts here -------------
<!- example.xml -->

<?xml version="1.0" encoding="ISO-8859-1"?>
<tagMeta>
  <metaKey>
    <keyContent>
        How to dynamically insert META Tag in an HTML document
    <keyContent>
  <metaKey>
<tagMeta>


<!- example.xsl -->

<?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>
    <head>
        <meta name="keywords" content="<xsl:value-of select="/metaKey/keycontent"/>
    </head>
  <body>

  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

<!- example.html -->

<html>
<body>
<script type="text/javascript">
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("example.xml")

// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("example.xsl")

// Transform
document.write(xml.transformNode(xsl))
</script>

</body>

reply soon please

 
Old August 12th, 2004, 06:03 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Your path should be:

/tagMeta/metaKey/keyContent

or for a relative path as your at the root already:

tagMeta/metaKey/keyContent

(Note capital C in keyContent)





--

Joe (MVP - xml)
 
Old September 19th, 2004, 12:24 PM
Authorized User
 
Join Date: Mar 2004
Location: , , Latvia.
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't know JavaScript, but to me this row didn't look correct:
<meta name="keywords" content="<xsl:value-of select="/metaKey/keycontent"/>
As obviously there is one '>' missing.

But I don't succeed this without JavaScript too, because it says that I cannot use the variable "<xsl:value-of select=''>" in arguments... :(

So, is there a way I can dynamically set, for example, page content description?

Thanks,
Janis




Similar Threads
Thread Thread Starter Forum Replies Last Post
<meta> tag is appearing in xml file saurabh_inblore XSLT 2 April 24th, 2006 11:56 PM
How to insert <META> tagg in .HTML whn is loaded? Abdul Hameed HTML Code Clinic 3 August 12th, 2004 04:49 AM
How to dynamically insert <META> tag in .HTML? Abdul Hameed Javascript 1 August 11th, 2004 10:03 AM
How to insert <META> Tag using XSLT on client Abdul Hameed XML 0 August 10th, 2004 11:34 PM
how to dynamically insert <META> tag in .html Abdul Hameed XSLT 1 August 10th, 2004 03:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.