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

[XSLT2] Php tags inside attributes

Subject: [XSLT2] Php tags inside attributes
From: "mario" <mario@xxxxxxxxxxx>
Date: Tue, 4 Jul 2006 23:13:23 +0100
php xslt2
Finally...
I had this problem generating php output, and couldn't find an answer
anywhere.
Escaping into elements was easy with xsl:text, but inside attributes,...
that was a different story.
After looking through other posts, i reached a solution

<!-- fragment of the stylesheet -->
<xsl:output 	method="html" 
			encoding="iso-8859-1"
			omit-xml-declaration="yes"
			use-character-maps="phpTags"
			escape-uri-attributes="no"
			/>

<xsl:character-map name="phpTags">
	<xsl:output-character character="&#60;" string="&#60;"/>
	<xsl:output-character character="&#62;" string="&#62;"/>
</xsl:character-map>


<!-- fragment of the source -->
<form method="post" action="&lt;?=$_POST['name']?&gt;">
	Name: <input type="textbox" value="&lt;?=$_POST['name']?&gt;"
name="name"/><br/>
	Address: <input type="textbox" value="&lt;?=$_POST['add']?&gt;"
name="add"/>
</form>

<!-- generated output -->
<form method="post" action="<?=$_POST['name']?>">
	Name: <input type="textbox" value="<?=$_POST['name']?>"
name="name"><br>
	Address: <input type="textbox" value="<?=$_POST['add']?>"
name="add">
</form>


The escape-uri-attributes seems necessary for the "action" and "href"
attributes, but not for the "value".
I guess "value" is not na uri attribute. :)

Current Thread

Back To School Sale!

Save 30% off all Stylus Studio 2008 Products when you purchase from our Online Shop.

Offer ends August 31, 2008.

Coupon Code
TRTY-C4JV-OFF

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-2007 All Rights Reserved.