[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem with Output special char in HTML attribute
In addition to what Jeni said (you should able to get the tab count from
your source?) you can do it by writing to the output stream.
I have had to do something similar, but with JSP 1.2 (the one with no Expression Language). Basically, I created some elements in the source, like: <jsp:scriptlet> String id = someAction.getId(); </jsp:scriptlet> <jspp:outputElement name="a"> <jspp:outputAttribute name="href"> <jspp:concat str_value="next-page.jsp?id="/> <jspp:concat var_value="id"/> </jspp:outputAttribute> </jspp:outputElement> Then the transformation to the JSP (hope you can parse this into PHP) does:
<xsl:template match="jspp:outputAttribute"/> <xsl:template match="jspp:outputAttribute" mode="attrOut"> <xsl:choose> <xsl:when test="boolean(@name)"> out.print(" "); out.print("<xsl:value-of select="@name"/>"); out.print("='"); <xsl:choose> <xsl:when test="boolean(@str_value)"> out.print("<xsl:value-of select="@str_value"/>"); </xsl:when> <xsl:when test="boolean(@var_value)"> out.print(<xsl:value-of select="@var_value"/>); </xsl:when> <xsl:otherwise> out.print(<xsl:apply-templates/>); </xsl:otherwise> </xsl:choose> out.print("'"); </xsl:when> <xsl:otherwise> <xsl:apply-templates mode="attrOut"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="jspp:concat"> <xsl:if test="not($context='0')"> <xsl:if test="preceding-sibling::jspp:concat"> <xsl:text> + </xsl:text> </xsl:if> <xsl:choose> <xsl:when test="boolean(@str_value)"> <xsl:text>"</xsl:text> <xsl:value-of select="@str_value"/> <xsl:text>"</xsl:text> </xsl:when> <xsl:when test="boolean(@var_value)"> <xsl:value-of select="@var_value"/> </xsl:when> </xsl:choose> </xsl:if> </xsl:template> Let me know if it does not make sense. best, -Rob Fabio Cuomo wrote: Hi at all, i've a problem with outputting special chars with xsl, particularly given the following :
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|