Новости | FAQ | Авторы | Документация | В действии | Библиотека |
Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
DivineArtS 19.05.2010 20:40
реально получилось передать данные через XSLT-params как описано тут<?xml version="1.0" encoding="windows-1251"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" encoding="windows-1251" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> <xsl:template match="body"> <xsl:param name="bk" /> <xsl:param name="chapter" /> <xsl:param name="verse" /> <html> <head> <title><xsl:value-of select="book-title" /></title> <link href="bible.css" rel="stylesheet" type="text/css" /> </head> <body> <xsl:apply-templates select="//book" /> </body> </html> </xsl:template> <xsl:template match="book"> <xsl:choose> <xsl:when test="position() = $bk"> <table cellpadding="0" cellspacing="0"> <xsl:if test="$chapter < 2 and $verse=''"><tr> <td class="book" colspan="2"><xsl:apply-templates select="title" /> </td> </tr></xsl:if> <xsl:apply-templates select="chap" /> </table> </xsl:when> </xsl:choose> </xsl:template> <xsl:template match="chap"> <xsl:choose> <xsl:when test="./@id = $chapter"> <tr> <xsl:if test="$verse=''"><td class="chapter_head"><xsl:value-of select="./@id" /></td></xsl:if> <td class="text"><xsl:apply-templates select="p" /> </td> </tr> </xsl:when> <xsl:otherwise> <xsl:if test="$chapter=''"><tr> <td class="chapter_head"><xsl:value-of select="./@id" /></td> <td class="text"><xsl:apply-templates select="p" /> </td> </tr></xsl:if> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="p"> <xsl:choose> <xsl:when test="./@vers = $verse"> <p><span class="scripture"><xsl:value-of select="//book[position()= $bk]/title" /> <xsl:value-of select="$chapter" />:<xsl:value-of select="./@vers" /></span> <span class="scriptureQuote"><xsl:value-of select="concat('“' , . , '')" /></span></p> </xsl:when> <xsl:otherwise> <xsl:if test="$verse=''"><p><span class="verse"><xsl:value-of select="./@vers" /></span><xsl:value-of select="." /></p></xsl:if> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> # входной xdoc документ $sourceDoc[^xdoc::load[/bible/bible.xml]] # преобразование xdoc документа шаблоном article.xsl $transformedDoc[^sourceDoc.transform[/bible/bible.xsl][$.bk[$form:bk]$.chapter[$form:ch]$.verse[$form:ver]]] # выдача результата в HTML виде ^transformedDoc.string[ $.method[html] ]возник другой вопрос...
$s[^str.split[,;hl] и ^for[ss](1;^s._count[]){...}(xslt:for-each тут не подойдет вроде)