be less rigid, however run as a test.
[pin4sha_cgi.git] / tests / test-delete-ok.sh.xslt
blob0f94ccde31f383fcad2eb5dfe15da0bc0a102b33
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
4 Copyright (c) 2015-2016 Marcus Rohrmoser http://mro.name/me. All rights reserved.
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 Find all 'delete_link' POST forms and list lf_linkdate and token.
22 $ xsltproc - -html ../tests/test-delete-ok.sh.xslt curl.tmp.html
24 http://www.w3.org/TR/xslt
25 -->
26 <xsl:stylesheet
27 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28 exclude-result-prefixes="xsl"
29 version="1.0">
30 <xsl:output method="text"/>
32 <xsl:template match="/">
33 <xsl:for-each select="html/body//form[.//input/@name='delete_link' and .//input/@name='lf_linkdate' and .//input/@name='token']">
34 <xsl:variable name="lf_linkdate" select=".//input[@name='lf_linkdate']/@value"/>
35 <xsl:variable name="token" select=".//input[@name='token']/@value"/>
36 <xsl:value-of select="$lf_linkdate"/><xsl:text> </xsl:text><xsl:value-of select="$token"/><xsl:text>
37 </xsl:text>
38 </xsl:for-each>
39 <xsl:for-each select="html/body//a[contains(@href, '?delete_link=') and contains(@href, '&amp;token=')]">
40 <xsl:variable name="lf_linkdate" select="substring-before(substring-after(@href,'?delete_link='), '&amp;token=')"/>
41 <xsl:variable name="token" select="substring-after(@href,'&amp;token=')"/>
42 <xsl:value-of select="$lf_linkdate"/><xsl:text> </xsl:text><xsl:value-of select="$token"/><xsl:text>
43 </xsl:text>
44 </xsl:for-each>
45 </xsl:template>
47 </xsl:stylesheet>