summaryrefslogtreecommitdiff
path: root/docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl
diff options
context:
space:
mode:
authorPaul Everitt <paul@agendaless.com>2008-07-24 17:14:16 +0000
committerPaul Everitt <paul@agendaless.com>2008-07-24 17:14:16 +0000
commit1a7b14de4bc89ef0fd162ef8e62d01926e42b54e (patch)
tree8d9ccc8187ac29eb80ac310c6f82c17d548cdf54 /docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl
parentc1a6ef6f751a16b7a352bc3fdad13d4b5b73f212 (diff)
downloadpyramid-1a7b14de4bc89ef0fd162ef8e62d01926e42b54e.tar.gz
pyramid-1a7b14de4bc89ef0fd162ef8e62d01926e42b54e.tar.bz2
pyramid-1a7b14de4bc89ef0fd162ef8e62d01926e42b54e.zip
Add tutorial sections
Diffstat (limited to 'docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl')
-rw-r--r--docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl69
1 files changed, 69 insertions, 0 deletions
diff --git a/docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl b/docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl
new file mode 100644
index 000000000..2406987d0
--- /dev/null
+++ b/docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:param name="contextid">n1</xsl:param>
+ <xsl:variable name="contextnode" select="id($contextid)"/>
+ <xsl:template match="/">
+ <html>
+ <head>
+ <title>
+ <xsl:value-of select="$contextnode/title"/>
+ </title>
+ </head>
+ <body>
+ <h2>
+ <xsl:value-of select="$contextnode/title"/>
+ </h2>
+ <xsl:apply-templates select="$contextnode"/>
+ <table border="1" cellpadding="6" cellspacing="0">
+ <tr>
+ <th>Type</th>
+ <th>@xml:id</th>
+ <th>@name</th>
+ <th>Parent Type</th>
+ <th>Parent @name</th>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of select="name($contextnode)"/>
+ </td>
+ <td>
+ <xsl:value-of select="$contextnode/@xml:id"/>
+ </td>
+ <td>
+ <xsl:value-of select="$contextnode/@name"/>
+ </td>
+ <td>
+ <xsl:value-of select="name($contextnode/..)"/>
+ </td>
+ <td>
+ <xsl:value-of select="$contextnode/../@name"/>
+ </td>
+ </tr>
+ </table>
+ </body>
+ </html>
+ </xsl:template>
+ <xsl:template match="folder">
+ <p>
+ <em>Folders are special, they contain things.</em>
+ </p>
+ <xsl:if test="*[@xml:id]">
+ <h2>Folder Contents</h2>
+ <ul>
+ <xsl:for-each select="*[@xml:id]">
+ <li>
+ <a href="{../@name}/{@name}">
+ <xsl:value-of select="title"/>
+ </a>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="document">
+ <p>
+ <em>Documents contain text.</em>
+ </p>
+ <xsl:copy-of select="body/*"/>
+ </xsl:template>
+</xsl:stylesheet>