Created
September 5, 2012 08:57
-
-
Save georgebashi/3633638 to your computer and use it in GitHub Desktop.
XQuery and XSLT intro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<hello> | |
<person name="edd" /> | |
<person name="chrisp" /> | |
</hello> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<p>hello, these are my friends:</p> | |
<ul>{ | |
for $person in //person | |
let $name := $person/@name | |
return <li>{string($name)}</li> | |
}</ul> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> | |
<xsl:template match="person"> | |
<li> | |
<xsl:value-of select="@name"/> | |
</li> | |
</xsl:template> | |
<xsl:template match="hello"> | |
<ul> | |
<xsl:apply-templates/> | |
</ul> | |
</xsl:template> | |
<xsl:template match="/"> | |
<html> | |
<p> | |
<xsl:text>hello, these are my friends:</xsl:text> | |
</p> | |
<xsl:apply-templates/> | |
</html> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment