XSLT/XML --> XHTML
Posted: Sat Apr 15, 2006 7:07 pm
Awesome... I've just started playing around with this
What have a been missing out on!?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<form action="<xsl:value-of select="/page/action"/>" method="post">
Code: Select all
<form action="{/page/action}" method="post"></form>
Code: Select all
<xsl:if test="count(items/item) > 0">
<ul>
<xsl:for-each select="items/item">
<li><a href="{link}"><xsl:value-of select="title"/></a></li>
</xsl:for-each>
</ul>
</xsl:if>
Code: Select all
<xsl:value-of select="attribute[@name='content']" disable-output-escaping="yes"/>
Code: Select all
<xsl:output method="html"/>
Handy to know thankstimvw wrote:Things that i remember from playing with it:
(The syntax higlighter seems to be still broken...)
The following does NOT work:
The solution:Code: Select all
<form action="<xsl:value-of select="/page/action"/>" method="post">
When building lists, make sure they are not empty (eg:)Code: Select all
<form action="{/page/action}" method="post"></form>
If you don't want the xml version of htmlentities on your data use disable-output-escaping="yes"Code: Select all
<xsl:if test="count(items/item) > 0"> <ul> <xsl:for-each select="items/item"> <li><a href="{link}"><xsl:value-of select="title"/></a></li> </xsl:for-each> </ul> </xsl:if>
Some versions of php use to transform <textarea></textarea> to <textarea/> to avoid this:Code: Select all
<xsl:value-of select="attribute[@name='content']" disable-output-escaping="yes"/>
Code: Select all
<xsl:output method="html"/>
XML I'm sure you know. XSLT allows you to transform XML (or rather XSL) into other formats such as HTML or XHTML (or even another XML document). I've stumbled upon using it as a means of making my markup more readable and smaller in size since what I'm doing at the moment is a little obscure.shiznatix wrote:uhhhhh what is it? i don't know what a have been missing out on :p
You can actually just add attribute using XSLT inline in any casetimvw wrote:Things that i remember from playing with it:
(The syntax higlighter seems to be still broken...)
The following does NOT work:
The solution:Code: Select all
<form action="<xsl:value-of select="/page/action"/>" method="post">
Code: Select all
<form action="{/page/action}" method="post"></form>
Code: Select all
<form method="post">
<xsl:attribute name="action">
<xsl:value-of select="/page/action"/>
</xsl:attribute>