[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: using xsl:output-character to render characters in

Subject: Re: using xsl:output-character to render characters in 2 ways
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 13 Nov 2009 17:39:23 +0100
Re:  using xsl:output-character to render characters in
Tom T wrote:
I'll change my example.

Financial Times, "ErdoDan Grubu'na"

creates

  <meta name="description"
            content='Financial Times, &#34;ErdoDan Grubu'na&#34;'
            />

I now have an attribute that is marked up by single quotes containing
a single quote. IE6 for one cannot deal with this.

Is the above 'meta' element the output of an XSLT processor? Which one do you use?


For instance when I have an input XML with your above text

<desc>Financial Times, "ErdoDan Grubu'na"</desc>

and then use Saxon 9.2.0.3 to run the stylesheet

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="xs"
  version="2.0">

<xsl:output indent="yes" method="xhtml" omit-xml-declaration="yes"/>

  <xsl:template match="/">
    <html>
      <head>
        <title>Example</title>
        <xsl:apply-templates select="desc"/>
      </head>
      <body>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="desc">
    <meta name="description" content="{.}"/>
  </xsl:template>

</xsl:stylesheet>

against that input then the resulting XHTML document is

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Example</title>
<meta name="description" content="Financial Times, &#34;ErdoDan Grubu'na&#34;" />
</head>
<body></body>
</html>


and that output looks fine to me, the content attribute value is delimited by double quotes and therefore any double quote in the value is escaped.



--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.