Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] [XSLT2] Php tags inside attributes

From: "mario" <mario@----------->
To:
Date: 7/4/2006 10:11:00 PM
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. :)


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent