Files
RedBear-OS/local/recipes/kde/kf6-syntaxhighlighting/source/autotests/folding/highlight.xsl.fold
T

110 lines
7.3 KiB
XML

<beginfold id='1'><?</beginfold id='1'>xml version="1.0" encoding="iso-8859-15"<endfold id='1'>?></endfold id='1'>
<beginfold id='2'><!--</beginfold id='2'>
This file is freely distributable, created by Wilbert Berendsen (wbsoft@xs4all.nl)
This is just a simple XSLT file that converts some HTML pages to a XBEL bookmarklist.
It is included here to test the new XSLT highlighting by Peter Lammich.
TODO: add better test file.
<endfold id='2'>--></endfold id='2'>
<beginfold id='3'><</beginfold id='3'>xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:h="http://www.w3.org/1999/xhtml">
<beginfold id='3'><</beginfold id='3'>xsl:output method="xml" encoding="iso-8859-15" indent="yes"
doctype-public="+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML"
doctype-system="http://www.python.org/topics/xml/dtds/xbel-1.0.dtd"
<endfold id='3'>/></endfold id='3'>
<beginfold id='2'><!--</beginfold id='2'> main <endfold id='2'>--></endfold id='2'>
<beginfold id='3'><</beginfold id='3'>xsl:template match="/">
<beginfold id='3'><</beginfold id='3'>xbel><beginfold id='3'><</beginfold id='3'>folder><beginfold id='3'><</beginfold id='3'>title>Linux at Home Links<endfold id='3'></</endfold id='3'>title>
<beginfold id='3'><</beginfold id='3'>xsl:for-each select="//*[@id='maincontents']//h:li">
<beginfold id='3'><</beginfold id='3'>xsl:variable name="f" select="document(h:a/@href)/h:html"<endfold id='3'>/></endfold id='3'>
<beginfold id='3'><</beginfold id='3'>folder>
<beginfold id='3'><</beginfold id='3'>title><beginfold id='3'><</beginfold id='3'>xsl:value-of select="h:a/h:strong"<endfold id='3'>/></endfold id='3'><endfold id='3'></</endfold id='3'>title>
<beginfold id='3'><</beginfold id='3'>desc><beginfold id='3'><</beginfold id='3'>xsl:value-of select="normalize-space(h:a/text())"<endfold id='3'>/></endfold id='3'><endfold id='3'></</endfold id='3'>desc>
<beginfold id='3'><</beginfold id='3'>xsl:for-each select="$f//h:div[@id='maincontents']">
<beginfold id='3'><</beginfold id='3'>xsl:call-template name="getbookmarks"<endfold id='3'>/></endfold id='3'>
<endfold id='3'></</endfold id='3'>xsl:for-each>
<endfold id='3'></</endfold id='3'>folder>
<endfold id='3'></</endfold id='3'>xsl:for-each>
<endfold id='3'></</endfold id='3'>folder><endfold id='3'></</endfold id='3'>xbel>
<endfold id='3'></</endfold id='3'>xsl:template>
<beginfold id='2'><!--</beginfold id='2'> end of main <endfold id='2'>--></endfold id='2'>
<beginfold id='2'><!--</beginfold id='2'> get bookmarks from a page <endfold id='2'>--></endfold id='2'>
<beginfold id='3'><</beginfold id='3'>xsl:template name="getbookmarks">
<beginfold id='3'><</beginfold id='3'>xsl:choose>
<beginfold id='2'><!--</beginfold id='2'> harvest links from p or li elements <endfold id='2'>--></endfold id='2'>
<beginfold id='3'><</beginfold id='3'>xsl:when test="self::h:li or self::h:p">
<beginfold id='3'><</beginfold id='3'>xsl:variable name="t" select="normalize-space()"<endfold id='3'>/></endfold id='3'>
<beginfold id='3'><</beginfold id='3'>xsl:for-each select=".//h:a[1]">
<beginfold id='3'><</beginfold id='3'>xsl:call-template name="bookmark">
<beginfold id='3'><</beginfold id='3'>xsl:with-param name="desc" select="$t"<endfold id='3'>/></endfold id='3'>
<endfold id='3'></</endfold id='3'>xsl:call-template>
<endfold id='3'></</endfold id='3'>xsl:for-each>
<beginfold id='3'><</beginfold id='3'>xsl:for-each select=".//h:a[position()!=1]">
<beginfold id='3'><</beginfold id='3'>xsl:call-template name="bookmark"<endfold id='3'>/></endfold id='3'>
<endfold id='3'></</endfold id='3'>xsl:for-each>
<endfold id='3'></</endfold id='3'>xsl:when>
<beginfold id='3'><</beginfold id='3'>xsl:otherwise>
<beginfold id='3'><</beginfold id='3'>xsl:for-each select="*">
<beginfold id='3'><</beginfold id='3'>xsl:call-template name="getbookmarks"<endfold id='3'>/></endfold id='3'>
<endfold id='3'></</endfold id='3'>xsl:for-each>
<endfold id='3'></</endfold id='3'>xsl:otherwise>
<endfold id='3'></</endfold id='3'>xsl:choose>
<endfold id='3'></</endfold id='3'>xsl:template>
<beginfold id='3'><</beginfold id='3'>xsl:template name="bookmark">
<beginfold id='3'><</beginfold id='3'>xsl:param name="href" select="@href"<endfold id='3'>/></endfold id='3'>
<beginfold id='3'><</beginfold id='3'>xsl:param name="desc" select="''"<endfold id='3'>/></endfold id='3'>
<beginfold id='3'><</beginfold id='3'>xsl:param name="title" select="normalize-space()"<endfold id='3'>/></endfold id='3'>
<beginfold id='3'><</beginfold id='3'>xsl:variable name="realdesc">
<beginfold id='3'><</beginfold id='3'>xsl:choose>
<beginfold id='3'><</beginfold id='3'>xsl:when test="starts-with($desc,$title)">
<beginfold id='3'><</beginfold id='3'>xsl:choose>
<beginfold id='3'><</beginfold id='3'>xsl:when test="starts-with(translate(substring-after($desc,$title),',.;','...'),'.')">
<beginfold id='3'><</beginfold id='3'>xsl:value-of select="substring($desc,string-length($title) + 2)"<endfold id='3'>/></endfold id='3'>
<endfold id='3'></</endfold id='3'>xsl:when>
<beginfold id='3'><</beginfold id='3'>xsl:otherwise>
<beginfold id='3'><</beginfold id='3'>xsl:value-of select="substring-after($desc,$title)"<endfold id='3'>/></endfold id='3'>
<endfold id='3'></</endfold id='3'>xsl:otherwise>
<endfold id='3'></</endfold id='3'>xsl:choose>
<endfold id='3'></</endfold id='3'>xsl:when>
<beginfold id='3'><</beginfold id='3'>xsl:otherwise>
<beginfold id='3'><</beginfold id='3'>xsl:value-of select="$desc"<endfold id='3'>/></endfold id='3'>
<endfold id='3'></</endfold id='3'>xsl:otherwise>
<endfold id='3'></</endfold id='3'>xsl:choose>
<endfold id='3'></</endfold id='3'>xsl:variable>
<beginfold id='3'><</beginfold id='3'>bookmark>
<beginfold id='3'><</beginfold id='3'>xsl:attribute name="href">
<beginfold id='3'><</beginfold id='3'>xsl:choose>
<beginfold id='3'><</beginfold id='3'>xsl:when test="starts-with($href,'http://') or starts-with($href,'ftp://') or starts-with($href,'mailto:')">
<beginfold id='3'><</beginfold id='3'>xsl:value-of select="$href"<endfold id='3'>/></endfold id='3'>
<endfold id='3'></</endfold id='3'>xsl:when>
<beginfold id='3'><</beginfold id='3'>xsl:otherwise>
<beginfold id='3'><</beginfold id='3'>xsl:value-of select="concat('http://www.xs4all.nl/~wbsoft/linux/links/',$href)"<endfold id='3'>/></endfold id='3'>
<endfold id='3'></</endfold id='3'>xsl:otherwise>
<endfold id='3'></</endfold id='3'>xsl:choose>
<endfold id='3'></</endfold id='3'>xsl:attribute>
<beginfold id='3'><</beginfold id='3'>title><beginfold id='3'><</beginfold id='3'>xsl:value-of select="normalize-space($title)"<endfold id='3'>/></endfold id='3'><endfold id='3'></</endfold id='3'>title>
<beginfold id='3'><</beginfold id='3'>xsl:if test="normalize-space($realdesc) != ''">
<beginfold id='3'><</beginfold id='3'>desc><beginfold id='3'><</beginfold id='3'>xsl:value-of select="normalize-space($realdesc)"<endfold id='3'>/></endfold id='3'><endfold id='3'></</endfold id='3'>desc>
<endfold id='3'></</endfold id='3'>xsl:if>
<endfold id='3'></</endfold id='3'>bookmark>
<endfold id='3'></</endfold id='3'>xsl:template>
<endfold id='3'></</endfold id='3'>xsl:stylesheet>