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

Re: Copying nodes in XSLT, quoting goes funny.

Subject: Re: Copying nodes in XSLT, quoting goes funny.
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Wed, 16 Apr 2008 13:27:15 +0200
Re:  Copying nodes in XSLT
David schrieb:
Trouble is, on the outputted document it gives me a tag like this :

<span style="background-color: #ff4411;"
onclick='doSomethingFun("Hello world!!!");' />

Looks like because there are double quotes within the value, it is
using single quotes. But the other attribute is using double quotes.

This works for me:


mludwig@forelle:~/Werkstatt/xsl > cat quotes.php
<?php
$doc = new DOMDocument;
$doc->load('quotes.xsl');
$xsl = new XSLTProcessor;
$xsl->importStyleSheet($doc);
$doc->loadXML('<Urmel/>');
echo $xsl->transformToXML($doc);
mludwig@forelle:~/Werkstatt/xsl > expand -t2 quotes.xsl
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<span>
<xsl:attribute
name="style">background-color: #ff4411;</xsl:attribute>
<xsl:attribute
name="onclick">doSomethingFun("Hello world!!!");</xsl:attribute>
</span>
</xsl:template>
</xsl:transform>
mludwig@forelle:~/Werkstatt/xsl > php quotes.php
<?xml version="1.0"?>
<span style="background-color: #ff4411;" onclick="doSomethingFun(&quot;Hello world!!!&quot;);"/>


It's using entities without needing special instruction.

Michael

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.