Subject: [xsl] [XSLT2] Php tags inside attributes From: "mario" <mario@xxxxxxxxxxx> Date: Tue, 4 Jul 2006 23:13:23 +0100 |
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="<" string="<"/> <xsl:output-character character=">" string=">"/> </xsl:character-map> <!-- fragment of the source --> <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> <!-- 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Transforming/trimming tex, Nadia . Swaby | Thread | [xsl] Having Trouble With Condition, Duncan Anker |
Re: [xsl] Theory question: Node tre, MrDemeanour | Date | [xsl] Having Trouble With Condition, Duncan Anker |
Month |