At 2006-04-21 22:38 -0700, Kerry Kobashi wrote:
I would like to substitute values for the language, description, and
keyword metatags in my stylesheet below.
You don't show your source XML so I cannot show your necessary XPath
addresses ... but there is an anomaly in what I see in your
stylesheet, so I'm surprised that what you have works at all.
How could I accomplish this?
The easiest in this situation is the attribute value template ...
since you are setting a value in the attribute of a literal result element.
Use: attribute-name="{XPath-expression}"
You can use any number of expressions in a single attribute, such as:
attribute-name="http://{XPath-expr-1}/{XPath-expr-2}"
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="language substitution here" lang="language substitution here">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="{..use-XPath-here..}" lang="{..use-XPath-here..}">
<head>
<title><xsl:value-of select="manufacturer"/>
<xsl:value-of select="model"/></title>
The above will not give you two values because your current node is
the root node and you are addressing element children ... and there
is only ever one element child of the root node. So one of those two
may work, but certainly not both.
<meta name="description" content="description
substitution here"/>
<meta name="description" content="{..use-XPath-here}"/>
<meta name="keywords" content="keyword substitution here"/>
<meta name="keywords" content="{..use-XPath-here}"/>
<meta http-equiv="Content-Language"
content="language substitution here"/>
<meta http-equiv="Content-Language" content="{..use-XPath-here}"/>
</head>
<body>
blah blah blah
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I hope this helps.
. . . . . . . . . . . Ken
--
Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16
Also for XSLT/XSL-FO training: Minneapolis, MN 2006-07-31/08-04
Also for XML/XSLT/XSL-FO training:Birmingham,England 2006-05-22/25
Also for XSLT/XSL-FO training: Copenhagen,Denmark 2006-05-08/11
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--