Enviar búsqueda
Cargar
Знакомство с XSLT
•
0 recomendaciones
•
537 vistas
A
Andrew Shitov
Seguir
Tecnología
Denunciar
Compartir
Denunciar
Compartir
1 de 71
Descargar ahora
Descargar para leer sin conexión
Recomendados
dasd
dasd
Vignesh Patil
Stress Management 3
Stress Management 3
Ahmed Zeen EL Abeden
Смарт-матчинг (~~)
Смарт-матчинг (~~)
Andrew Shitov
Acordo de Cooperação do Estado do Acre
Acordo de Cooperação do Estado do Acre
guest162130
Mulheres
Mulheres
Andoni Goiriena
Perl-мероприятия
Perl-мероприятия
Andrew Shitov
Cele O Mie De Insule
Cele O Mie De Insule
Navalitorul
DIPLOMADO EN MEDICINA FAMILIAR
DIPLOMADO EN MEDICINA FAMILIAR
guest28d61
Recomendados
dasd
dasd
Vignesh Patil
Stress Management 3
Stress Management 3
Ahmed Zeen EL Abeden
Смарт-матчинг (~~)
Смарт-матчинг (~~)
Andrew Shitov
Acordo de Cooperação do Estado do Acre
Acordo de Cooperação do Estado do Acre
guest162130
Mulheres
Mulheres
Andoni Goiriena
Perl-мероприятия
Perl-мероприятия
Andrew Shitov
Cele O Mie De Insule
Cele O Mie De Insule
Navalitorul
DIPLOMADO EN MEDICINA FAMILIAR
DIPLOMADO EN MEDICINA FAMILIAR
guest28d61
Educação
Educação
luisasousa
Bicicleta Dacia
Bicicleta Dacia
einsteine
Toolwi.Com
Toolwi.Com
Blogcamp Organization Committee
Frank L Loyd Wright
Frank L Loyd Wright
Muff
Artigo - Captação de recursos não reembolsáveis: dificuldades e limitações da...
Artigo - Captação de recursos não reembolsáveis: dificuldades e limitações da...
Mauricio Serafim
Guidelines for Assistant Referees
Guidelines for Assistant Referees
Diaitisia Administrator
Economia criativa ou indústria criativa: Delimitação de um Conceito em Constr...
Economia criativa ou indústria criativa: Delimitação de um Conceito em Constr...
Mauricio Serafim
Before Social Media
Before Social Media
Steve Goldner
Ikea
Ikea
Greg R.....
MíDia E Eu
MíDia E Eu
mireia.silva
день матери
день матери
Fintfin
ApresentaçãO Sala Vip Altercom 2008
ApresentaçãO Sala Vip Altercom 2008
Ricardo Campos
25 juni 2008: ICT in het biologieonderwijs
25 juni 2008: ICT in het biologieonderwijs
Elly Langewis
Potensi Strategi&Pendekatan Mengoptimum P&P
Potensi Strategi&Pendekatan Mengoptimum P&P
profmadyadrhjsuaidi
Thingsyoudon Tseeeveryday
Thingsyoudon Tseeeveryday
Navalitorul
Задачи бизнеса и эволюция DLP: какова следующая ступень?
Задачи бизнеса и эволюция DLP: какова следующая ступень?
InfoWatch
Formatos Da Web
Formatos Da Web
compassopropaganda
Bodyart
Bodyart
alex
Perl6 one-liners
Perl6 one-liners
Andrew Shitov
Creating a compiler in Perl 6
Creating a compiler in Perl 6
Andrew Shitov
Fun with Raspberry PI (and Perl)
Fun with Raspberry PI (and Perl)
Andrew Shitov
Perl6 in-production
Perl6 in-production
Andrew Shitov
Más contenido relacionado
Destacado
Educação
Educação
luisasousa
Bicicleta Dacia
Bicicleta Dacia
einsteine
Toolwi.Com
Toolwi.Com
Blogcamp Organization Committee
Frank L Loyd Wright
Frank L Loyd Wright
Muff
Artigo - Captação de recursos não reembolsáveis: dificuldades e limitações da...
Artigo - Captação de recursos não reembolsáveis: dificuldades e limitações da...
Mauricio Serafim
Guidelines for Assistant Referees
Guidelines for Assistant Referees
Diaitisia Administrator
Economia criativa ou indústria criativa: Delimitação de um Conceito em Constr...
Economia criativa ou indústria criativa: Delimitação de um Conceito em Constr...
Mauricio Serafim
Before Social Media
Before Social Media
Steve Goldner
Ikea
Ikea
Greg R.....
MíDia E Eu
MíDia E Eu
mireia.silva
день матери
день матери
Fintfin
ApresentaçãO Sala Vip Altercom 2008
ApresentaçãO Sala Vip Altercom 2008
Ricardo Campos
25 juni 2008: ICT in het biologieonderwijs
25 juni 2008: ICT in het biologieonderwijs
Elly Langewis
Potensi Strategi&Pendekatan Mengoptimum P&P
Potensi Strategi&Pendekatan Mengoptimum P&P
profmadyadrhjsuaidi
Thingsyoudon Tseeeveryday
Thingsyoudon Tseeeveryday
Navalitorul
Задачи бизнеса и эволюция DLP: какова следующая ступень?
Задачи бизнеса и эволюция DLP: какова следующая ступень?
InfoWatch
Formatos Da Web
Formatos Da Web
compassopropaganda
Bodyart
Bodyart
alex
Destacado
(18)
Educação
Educação
Bicicleta Dacia
Bicicleta Dacia
Toolwi.Com
Toolwi.Com
Frank L Loyd Wright
Frank L Loyd Wright
Artigo - Captação de recursos não reembolsáveis: dificuldades e limitações da...
Artigo - Captação de recursos não reembolsáveis: dificuldades e limitações da...
Guidelines for Assistant Referees
Guidelines for Assistant Referees
Economia criativa ou indústria criativa: Delimitação de um Conceito em Constr...
Economia criativa ou indústria criativa: Delimitação de um Conceito em Constr...
Before Social Media
Before Social Media
Ikea
Ikea
MíDia E Eu
MíDia E Eu
день матери
день матери
ApresentaçãO Sala Vip Altercom 2008
ApresentaçãO Sala Vip Altercom 2008
25 juni 2008: ICT in het biologieonderwijs
25 juni 2008: ICT in het biologieonderwijs
Potensi Strategi&Pendekatan Mengoptimum P&P
Potensi Strategi&Pendekatan Mengoptimum P&P
Thingsyoudon Tseeeveryday
Thingsyoudon Tseeeveryday
Задачи бизнеса и эволюция DLP: какова следующая ступень?
Задачи бизнеса и эволюция DLP: какова следующая ступень?
Formatos Da Web
Formatos Da Web
Bodyart
Bodyart
Más de Andrew Shitov
Perl6 one-liners
Perl6 one-liners
Andrew Shitov
Creating a compiler in Perl 6
Creating a compiler in Perl 6
Andrew Shitov
Fun with Raspberry PI (and Perl)
Fun with Raspberry PI (and Perl)
Andrew Shitov
Perl6 in-production
Perl6 in-production
Andrew Shitov
Параллельные вычисления в Perl 6
Параллельные вычисления в Perl 6
Andrew Shitov
AllPerlBooks.com
AllPerlBooks.com
Andrew Shitov
Perl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel Computing
Andrew Shitov
The Joy of Smartmatch
The Joy of Smartmatch
Andrew Shitov
YAPC::Europe 2013
YAPC::Europe 2013
Andrew Shitov
Perl 7, the story of
Perl 7, the story of
Andrew Shitov
Язык программирования Go для Perl-программистов
Язык программирования Go для Perl-программистов
Andrew Shitov
Как очистить массив
Как очистить массив
Andrew Shitov
What's new in Perl 5.14
What's new in Perl 5.14
Andrew Shitov
Что нового в Perl 5.14
Что нового в Perl 5.14
Andrew Shitov
Perl6 grammars
Perl6 grammars
Andrew Shitov
Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6
Andrew Shitov
There's more than one way to empty it
There's more than one way to empty it
Andrew Shitov
Perl 6 by example
Perl 6 by example
Andrew Shitov
How to clean an array
How to clean an array
Andrew Shitov
Perl 5.10 и 5.12
Perl 5.10 и 5.12
Andrew Shitov
Más de Andrew Shitov
(20)
Perl6 one-liners
Perl6 one-liners
Creating a compiler in Perl 6
Creating a compiler in Perl 6
Fun with Raspberry PI (and Perl)
Fun with Raspberry PI (and Perl)
Perl6 in-production
Perl6 in-production
Параллельные вычисления в Perl 6
Параллельные вычисления в Perl 6
AllPerlBooks.com
AllPerlBooks.com
Perl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel Computing
The Joy of Smartmatch
The Joy of Smartmatch
YAPC::Europe 2013
YAPC::Europe 2013
Perl 7, the story of
Perl 7, the story of
Язык программирования Go для Perl-программистов
Язык программирования Go для Perl-программистов
Как очистить массив
Как очистить массив
What's new in Perl 5.14
What's new in Perl 5.14
Что нового в Perl 5.14
Что нового в Perl 5.14
Perl6 grammars
Perl6 grammars
Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6
There's more than one way to empty it
There's more than one way to empty it
Perl 6 by example
Perl 6 by example
How to clean an array
How to clean an array
Perl 5.10 и 5.12
Perl 5.10 и 5.12
Знакомство с XSLT
1.
XSLT
2.
XSLT is .
. . XML XSLT XSL-FO XPath
3.
XSLT is .
. . XML XSLT XSL-FO XPath
4.
Аналогия
XML HTML ~ + + XSLT CSS
5.
Аналогия
XML HTML ~ + + XSLT CSS XPath Selector
6.
Назначение
XSLT XML XML
7.
Назначение
XSLT XML HTML Сервер Браузер
8.
Назначение
XSLT XML HTML Сервер Браузер
9.
Declaration <xsl:stylesheet version=quot;1.0quot; xmlns:xsl= quot;http://www.w3.org/ XSL/Transformquot;> . . . </xsl:stylesheet>
10.
Declaration <?xml version=quot;1.0quot;?> <xsl:stylesheet version=quot;1.0quot; xmlns:xsl= quot;http://www.w3.org/ XSL/Transformquot;> . . . </xsl:stylesheet>
11.
Рабочий пример <?xml version=quot;1.0quot;?> <page> <sections> <item href=quot;politicsquot;>Политика</item> <item href=quot;worldquot;>В мире</item> <item href=quot;economyquot;>Экономика</item> <item href=quot;societyquot;>Общество</item> </sections> </page>
12.
Рабочий пример <?xml version=quot;1.0quot;?> <page> <sections> <item href=quot;politicsquot;> <name>Политика</name> <item href=quot;russiaquot;>В России</item> <item href=quot;foreignquot;>Внешняя...</item> <item href=quot;senatequot;>Совет...</item> </item> <item href=quot;worldquot;>В мире</item> <item href=quot;economyquot;>Экономика</item> <item href=quot;societyquot;>Общество</item> </sections> </page>
13.
Рабочий пример <?xml version=quot;1.0quot;?> <page> <sections> <item href=quot;politicsquot;> <name>Политика</name> <item href=quot;russiaquot;> <name>В России</name> </item> <item href=quot;foreignquot;> <name>Внешняя политика</name> </item> <item href=quot;senatequot;> <name>Совет Федерации</name> </item> </item> . . . </sections> </page>
14.
Рабочий пример. Вариант
1 <?xml version=quot;1.0quot;?> <page> <sections> <item href=quot;politicsquot; name=quot;Политикаquot;> <item href=quot;russiaquot; name=quot;В Россииquot;/> <item href=quot;foreignquot; name=quot;Внешняя...quot;/> <item href=quot;senatequot; name=quot;Совет...quot;/> </item> <item href=quot;worldquot; name=quot;В миреquot;/> <item href=quot;economyquot; name=quot;Экономикаquot;/> <item href=quot;societyquot; name=quot;Обществоquot;/> </sections> </page>
15.
Ожидаемый результат <ul> <li> <a href=quot;/politics/quot;>Политика</a> <ul> <li><a href=quot;/politics/russia/quot;>В России</a></li> <li><a href=quot;/politics/foreign/quot;>Внешняя...</a></li> <li><a href=quot;/politics/senate/quot;>В России</a></li> </ul> </li> <li> <a href=quot;/world/quot;>В мире</a> </li> <li> <a href=quot;/society/quot;>Общество</a> </li> </ul>
16.
XSLT <?xml version=quot;1.0quot; encoding=quot;UTF‐8quot;?> <xsl:stylesheet version=quot;1.0quot; xmlns:xsl=quot;http://www.w3.org/1999/XSL/Transformquot;> <xsl:output encoding=quot;UTF‐8quot; indent=quot;yesquot;/> </xsl:stylesheet>
17.
XSLT <?xml version=quot;1.0quot; encoding=quot;UTF‐8quot;?> <xsl:stylesheet version=quot;1.0quot; xmlns:xsl=quot;http://www.w3.org/1999/XSL/Transformquot;> <xsl:output encoding=quot;UTF‐8quot; indent=quot;yesquot;/> <xsl:template match=quot;/pagequot;> <div> <xsl:for‐each select=quot;sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> </xsl:for‐each> </div> </xsl:template> </xsl:stylesheet>
18.
XSLT <xsl:template match=quot;/pagequot;> <div> <xsl:for‐each select=quot;sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> </xsl:for‐each> </div> </xsl:template>
19.
XSLT и XPath
XPath <xsl:template match=quot;/pagequot;> <div> <xsl:for‐each select=quot;sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> </xsl:for‐each> </div> </xsl:template>
20.
XML + XSLT
<page> <sections> <item href=quot;politicsquot; name=quot;Политикаquot;> <item href=quot;russiaquot; name=quot;В Россииquot;/> <item href=quot;foreignquot; name=quot;Внешняя...quot;/> <item href=quot;senatequot; name=quot;Совет...quot;/> </item> <item href=quot;worldquot; name=quot;В миреquot;/> <item href=quot;economyquot; name=quot;Экономикаquot;/> <item href=quot;societyquot; name=quot;Обществоquot;/> </sections> </page> <xsl:template match=quot;/pagequot;> <div> <xsl:for‐each select=quot;sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> </xsl:for‐each> </div> </xsl:template>
21.
XML + XSLT
<page> <sections> <item href=quot;politicsquot; name=quot;Политикаquot;> <item href=quot;russiaquot; name=quot;В Россииquot;/> <item href=quot;foreignquot; name=quot;Внешняя...quot;/> <item href=quot;senatequot; name=quot;Совет...quot;/> </item> <item href=quot;worldquot; name=quot;В миреquot;/> <item href=quot;economyquot; name=quot;Экономикаquot;/> <item href=quot;societyquot; name=quot;Обществоquot;/> </sections> </page> <xsl:template match=quot;/pagequot;> <div> <xsl:for‐each select=quot;sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> </xsl:for‐each> </div> </xsl:template>
22.
XML + XSLT
<page> <sections> <item href=quot;politicsquot; name=quot;Политикаquot;> <item href=quot;russiaquot; name=quot;В Россииquot;/> <item href=quot;foreignquot; name=quot;Внешняя...quot;/> <item href=quot;senatequot; name=quot;Совет...quot;/> </item> <item href=quot;worldquot; name=quot;В миреquot;/> <item href=quot;economyquot; name=quot;Экономикаquot;/> <item href=quot;societyquot; name=quot;Обществоquot;/> </sections> </page> <xsl:template match=quot;/pagequot;> <div> <xsl:for‐each select=quot;sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> </xsl:for‐each> </div> </xsl:template>
23.
XML + XSLT
<page> <sections> <item href=quot;politicsquot; name=quot;Политикаquot;> <item href=quot;russiaquot; name=quot;В Россииquot;/> <item href=quot;foreignquot; name=quot;Внешняя...quot;/> <item href=quot;senatequot; name=quot;Совет...quot;/> </item> <item href=quot;worldquot; name=quot;В миреquot;/> <item href=quot;economyquot; name=quot;Экономикаquot;/> <item href=quot;societyquot; name=quot;Обществоquot;/> </sections> </page> <xsl:template match=quot;/pagequot;> <div> <xsl:for‐each select=quot;sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> </xsl:for‐each> </div> </xsl:template>
24.
XML + XSLT
<page> <sections> <item href=quot;politicsquot; name=quot;Политикаquot;> <item href=quot;russiaquot; name=quot;В Россииquot;/> <item href=quot;foreignquot; name=quot;Внешняя...quot;/> <item href=quot;senatequot; name=quot;Совет...quot;/> </item> <item href=quot;worldquot; name=quot;В миреquot;/> <item href=quot;economyquot; name=quot;Экономикаquot;/> <item href=quot;societyquot; name=quot;Обществоquot;/> </sections> </page> <xsl:template match=quot;/pagequot;> <div> <xsl:for‐each select=quot;sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> </xsl:for‐each> </div> </xsl:template>
25.
HTML <?xml version=quot;1.0quot; encoding=quot;UTF‐8quot;?> <div> <a href=quot;politicsquot;>Политика</a> <a href=quot;worldquot;>В мире</a> <a href=quot;economyquot;>Экономика</a> <a href=quot;societyquot;>Общество</a> </div>
26.
XML + XSLT
<page> <sections> <item href=quot;politicsquot; name=quot;Политикаquot;> <item href=quot;russiaquot; name=quot;В Россииquot;/> <item href=quot;foreignquot; name=quot;Внешняя...quot;/> <item href=quot;senatequot; name=quot;Совет...quot;/> </item> <item href=quot;worldquot; name=quot;В миреquot;/> <item href=quot;economyquot; name=quot;Экономикаquot;/> <item href=quot;societyquot; name=quot;Обществоquot;/> </sections> </page> <xsl:template match=quot;/pagequot;> <div> <xsl:for‐each select=quot;sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> ? <xsl:for‐each select=quot;itemquot;> ? </xsl:for‐each> </div> </xsl:template>
27.
XSLT <xsl:template match=quot;/pagequot;> <div> <xsl:apply‐templates select=quot;sections/itemquot;/> </div> </xsl:template> <xsl:template match=quot;itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> <xsl:if test=quot;itemquot;> <div> <xsl:apply‐templates select=quot;itemquot;/> </div> </xsl:if> </xsl:template>
28.
XML + XSLT <xsl:template match=quot;/pagequot;> <div> <xsl:apply‐templates select=quot;sections/itemquot;/> </div> </xsl:template> <xsl:template match=quot;itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> <xsl:if test=quot;itemquot;> <div> <xsl:apply‐templates select=quot;itemquot;/> </div> </xsl:if> </xsl:template>
29.
XML + XSLT
= HTML <?xml version=quot;1.0quot; encoding=quot;UTF‐8quot;?> <div> <a href=quot;politicsquot;>Политика</a> <div> <a href=quot;russiaquot;>В России</a> <a href=quot;foreignquot;>Внешняя политика</a> <a href=quot;senatequot;>Совет Федерации</a> </div> <a href=quot;worldquot;>В мире</a> <a href=quot;economyquot;>Экономика</a> <a href=quot;societyquot;>Общество</a> </div>
30.
XML + XSLT
= HTML <?xml version=quot;1.0quot; encoding=quot;UTF‐8quot;?> <div> <a href=quot;/politics/quot;>Политика</a> <div> <a href=quot;/politics/russia/quot;>В России</a> <a href=quot;/politics/foreign/quot;>Внешняя политика</a> <a href=quot;/politics/senate/quot;>Совет Федерации</a> </div> <a href=quot;/world/quot;>В мире</a> <a href=quot;/economy/quot;>Экономика</a> <a href=quot;/society/quot;>Общество</a> </div>
31.
XSLT <xsl:template match=quot;itemquot;> <a href=quot;/{@href}/quot;> <xsl:value‐of select=quot;@namequot;/> </a> . . . </xsl:template>
32.
XSLT <xsl:template match=quot;itemquot;> <a href=quot;/{@href}/quot;> <xsl:if test=quot;parent::itemquot;> <xsl:attribute name=quot;hrefquot;> <xsl:text>/</xsl:text> <xsl:value‐of select=quot;../item/@hrefquot;/> <xsl:text>/</xsl:text> <xsl:value‐of select=quot;@hrefquot;/> <xsl:text>/</xsl:text> </xsl:attribute> </xsl:if> <xsl:value‐of select=quot;@namequot;/> </a> . . . </xsl:template>
33.
Рабочий пример. Вариант
2 <?xml version=quot;1.0quot;?> <page> <sections> <item href=quot;politicsquot; name=quot;Политикаquot;/> <item href=quot;worldquot; name=quot;В миреquot;/> <item href=quot;economyquot; name=quot;Экономикаquot;/> <item href=quot;societyquot; name=quot;Обществоquot;/> <item href=quot;russiaquot; name=quot;В Россииquot; parent=quot;politicsquot;/> <item href=quot;foreignquot; name=quot;Внешняя...quot; parent=quot;politicsquot;/> <item href=quot;senatequot; name=quot;Совет...quot; parent=quot;politicsquot;/> </sections> </page>
34.
Рабочий пример. Вариант
2 <?xml version=quot;1.0quot;?> <page> <sections> <item href=quot;politicsquot; name=quot;Политикаquot;/> <item href=quot;worldquot; name=quot;В миреquot;/> <item href=quot;economyquot; name=quot;Экономикаquot;/> <item href=quot;societyquot; name=quot;Обществоquot;/> <item href=quot;russiaquot; name=quot;В Россииquot; parent=quot;politicsquot;/> <item href=quot;foreignquot; name=quot;Внешняя...quot; parent=quot;politicsquot;/> <item href=quot;senatequot; name=quot;Совет...quot; parent=quot;politicsquot;/> </sections> </page>
35.
XSLT <xsl:template match=quot;/pagequot;> <div> <xsl:apply‐templates select=quot;sections/item[not (@parent)]quot;/> </div> </xsl:template>
36.
XSLT <xsl:template match=quot;itemquot;> <a href=quot;/{@href}/quot;> <xsl:if test=quot;@parentquot;> <xsl:attribute name=quot;hrefquot;> <xsl:text>/</xsl:text> <xsl:value‐of select=quot;@parentquot;/> <xsl:text>/</xsl:text> <xsl:value‐of select=quot;@hrefquot;/> <xsl:text>/</xsl:text> </xsl:attribute> </xsl:if> <xsl:value‐of select=quot;@namequot;/> </a> <xsl:if test=quot;../item[@parent = current()/@href]quot;> <div> <xsl:apply‐templates select=quot;../item[@parent = current()/@href]quot;/> </div> </xsl:if> </xsl:template>
37.
XSLT <xsl:template match=quot;itemquot;> <a href=quot;/{@parent}/{@href}/quot;> <xsl:value‐of select=quot;@namequot;/> </a> <xsl:if test=quot;../item[@parent = current()/@href]quot;> <div> <xsl:apply‐templates select=quot;../item[@parent = current()/@href]quot;/> </div> </xsl:if> </xsl:template>
38.
Примеры XPath-выражений a
a[last()] * a[position() = 2] a[1] a[position() = last()] a[b] a[@c] a[@title = quot;xxxquot;] /a a[count (b) = 3] //a a/b a[@title = @title2 and count (b) != 0] a//b a[@title = @title2][count (b) != 0] . .. a/*[name() = quot;unknownquot;] ./a a/*/b[@name or @sirname] @c ./@c ../../../a[d]//b[not (@title)]/text() @* * | text() tr[position() mod 2 = 1]
39.
Оси XPath (axis) self::b parent::b child::b descendant::b ancestor::b descendant‐or‐self::b ancestor‐or‐self::b following‐sibling::b preceding‐sibling::b attribute::c namespace::ns
40.
Оси XPath (axis) self::b
. parent::b ../b child::b b descendant::b .//b ancestor::b descendant‐or‐self::b .//b | . ancestor‐or‐self::b following‐sibling::b ../*[position() < preceding‐sibling::b current()/position()] attribute::c @c namespace::ns
41.
Арифметические операции в
XPath <xsl:value‐of select=quot;3quot;/> <xsl:value‐of select=quot;1 + 2quot;/> <xsl:value‐of select=quot;@price + @taxquot;/> <xsl:value‐of select=quot;@salary * 0.87quot;/> <xsl:value‐of select=quot;@visitors div 365quot;/> <xsl:value‐of select=quot;@days mod 7quot;/>
42.
Строковые функции в
XPath string (123) concat (quot;alphaquot;, quot;betaquot;) concat (node/@attr, quot;, quot;, @value) starts‐with (name(), quot;itemquot;) ends‐width contains (text(), quot;Tiananmenquot;) substring (quot;20070102quot;, 5, 2) substring‐before (quot;2007‐01‐02quot;, quot;‐quot;); substring‐after (quot;Aug 2007quot;, quot; quot;); string‐length (text())
43.
Прочие функции в
XPath <item value=quot;5quot;/> <item value=quot;2.3”/> <item value= quot;‐9.3quot;/> <xsl:value‐of select=quot;sum (item/@value)quot;/> <xsl:value‐of select=quot;number (text())quot;/> <xsl:value‐of select=quot;floor (@value)quot;/> <xsl:value‐of select=quot;ceiling (@value)quot;/> <xsl:value‐of select=quot;round (@value)quot;/> <xsl:value‐of select=quot;translate (text(), ‘abcdefghijklmnopqrstuvwxyz’, ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’quot;
44.
Элементы XSLT <xsl:import href=quot;another.xsltquot;/> <xsl:include href=quot;more.xsltquot;/> <xsl:output method=quot;htmlquot; | quot;xmlquot; | quot;textquot; encoding=quot;KOI8‐Rquot;
indent=quot;yesquot; | quot;noquot; />
45.
Элементы XSLT <xsl:import href=quot;another.xsltquot;/> <xsl:include href=quot;more.xsltquot;/> <xsl:output method=quot;htmlquot; | quot;xmlquot; | quot;textquot; encoding=quot;KOI8‐Rquot;
indent=quot;yesquot; | quot;noquot; /> <xsl:template match=quot;paraquot;> </xsl:template> <xsl:template name=quot;template‐namequot;> </xsl:template>
46.
Последовательность обхода XSLT <xsl:template match=quot;/quot;> </xsl:template> <xsl:template match=quot;/pagequot;> </xsl:template> <xsl:template match=quot;/page/sectionsquot;> </xsl:template> <xsl:template name=quot;sections/itemquot;> </xsl:template> <xsl:template name=quot;itemquot;> </xsl:template> <xsl:template match=quot;item[item]quot;/>
47.
Обработка узлов (создание
дерева) <xsl:template match=quot;/quot;> <html> <head> <xsl:apply‐templates select=quot;cssquot;/> <xsl:apply‐templates select=quot;jsquot;/> </head> <body> <xsl:apply‐templates select=quot;contentquot;/> </body> </html> </xsl:template>
48.
Обработка узлов <xsl:template match=quot;/quot;> <html> <head> <xsl:apply‐templates select=quot;cssquot;/> <xsl:apply‐templates select=quot;jsquot;/> </head> <body> <xsl:apply‐templates select=quot;contentquot;/> </body> </html> </xsl:template> <xsl:template match=quot;pagequot;> <xsl:apply‐templates select=quot;.quot;/> </xsl:template>
49.
Обработка узлов <css> <item>default.css</item> <item>weather.css</item> </css> <xsl:apply‐templates select=quot;cssquot;/> <xsl:template match=quot;cssquot;> <xsl:for‐each select=quot;itemquot;> <link rel=quot;stylesheetquot; type=quot;text/cssquot; href=quot;text()quot; /> </xsl:for‐each> </xsl:template>
50.
Обработка узлов <js> <item>default.js</item> <item>gwt.js</item> </js> <xsl:apply‐templates select=quot;jsquot;/> <xsl:template match=quot;jsquot;> <xsl:apply‐templates select=quot;itemquot;/> </xsl:template> <xsl:template match=quot;js/itemquot;> <script type=quot;text/javascriptquot; src=quot;text()quot;> </script> </xsl:template>
51.
mode <xsl:template match=quot;cssquot; mode=quot;headerquot;> <xsl:for‐each select=quot;itemquot;> <link rel=quot;stylesheetquot; type=quot;text/cssquot; href=quot;{text()}quot; /> </xsl:for‐each> </xsl:template> <xsl:template match=quot;cssquot; mode=quot;debugquot;> <ul> <xsl:for‐each select=quot;itemquot;> <li> <xsl:value‐of select=quot;text()quot;/> </li> </xsl:for‐each> </ul> </xsl:template>
52.
mode <xsl:template match=quot;/quot;> <html> <head> <xsl:apply‐templates select=quot;cssquot; mode=quot;headerquot; /> </head> <body> <xsl:apply‐templates select=quot;cssquot; mode=quot;debugquot; /> </body> </html> </xsl:template>
53.
Шаблон с именем <xsl:template name=quot;copywrightquot;> <div id=quot;Copywrightquot;> <xsl:text>© </xsl:text> <xsl:value‐of select=quot;/page/manifest/date/@year”/> </div> </xsl:template> <xsl:template match=quot;/quot;> . . . <body> <xsl:apply‐templates select=quot;contentquot;/> <xsl:call‐template name=quot;copywrightquot;/> </body> . . . </xsl:template>
54.
Создание элементов <xsl:element name=quot;bodyquot;> <xsl:copy‐of select=quot;/page/content/* | /page/content/text()quot;/> </xsl:element>
55.
Создание элементов и
аттрибутов <xsl:element name=quot;bodyquot;> <xsl:attribute name=quot;stylequot;> <xsl:text>background: white</xsl:text> </xsl:attribute> <xsl:copy‐of select=quot;/page/content/* | /page/content/text()quot;/> </xsl:element>
56.
Создание элементов и
аттрибутов <xsl:element name=quot;bodyquot;> <xsl:attribute name=quot;stylequot;> <xsl:text>background: white</xsl:text> </xsl:attribute> <xsl:copy‐of select=quot;/page/content/* | /page/content/text()quot;/> </xsl:element> ≈ <body style=quot;background: whitequot;> <xsl:apply‐templates select=quot;/page/contentquot;/> </body>
57.
Комментарии <!‐‐ xml comment ‐‐> <xsl:text disable‐output‐escaping=quot;yesquot;> <!‐‐ strange comment ‐‐> </xsl:text> <xsl:comment> xslt comment </xsl:comment>
58.
Нумерация <xsl:number level=quot;singlequot; | quot;multiplequot; | quot;anyquot; from=quot;sectionsquot; count=quot;itemquot; format=quot;Aquot; | quot;=1:2=quot; />
59.
Нумерация <xsl:template match=quot;itemquot;> <xsl:number format=quot;multiplequot;/> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;{text()}quot;/> </a> . . . </xsl:template> <div> 1<a href=quot;/politics/quot;>Политика</a> <div> 1.1<a href=quot;/russia/quot;>В России</a> 1.2<a href=quot;/foreign/quot;>Внешняя политика</a> 1.3<a href=quot;/senate/quot;>Совет Федерации</a> </div> . . .
60.
Условия <xsl:if test=quot;@colour = ‘white’quot;> <xsl:apply‐templates/> </xsl:if>
61.
Условия <xsl:if test=quot;@colour = ‘white’quot;> <xsl:apply‐templates/> </xsl:if> <xsl:choose> <xsl:when test=quot;@size < 10quot;> . . . </xsl:when> <xsl:when test=quot;@size = 10quot;> . . . </xsl:when> <xsl:otherwise> . . . </xsl:otherwise> </xsl:choose>
62.
Условия <xsl:if test=quot;@colour = ‘white’quot;> <xsl:apply‐templates/> </xsl:if> <xsl:choose> <xsl:when test=quot;@size < 10quot;> . . . </xsl:when> <xsl:when test=quot;@size = 10quot;> . . . </xsl:when> <xsl:otherwise> . . . </xsl:otherwise> </xsl:choose>
63.
Сортировка <xsl:sort select=quot;@hrefquot; order=quot;ascendingquot; | quot;descendingquot; case‐order= quot;upper‐firstquot; | quot;lower‐firstquot; /> <xsl:for‐each select=quot;itemquot;> <xsl:sort select=quot;text()quot;/> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;text()quot;/> </a> </xsl:for‐each>
64.
Переменные <xsl:variable name=quot;yearquot; select=quot;2007quot;/> <xsl:value‐of select=quot;$yearquot;/>
65.
Переменные <xsl:variable name=quot;yearquot; select=quot;2007quot;/> <xsl:value‐of select=quot;$yearquot;/> <xsl:variable name=quot;copywrightquot;> <p> <xsl:value‐of select=quot;$yearquot;/> </p> <ul> <xsl:for‐each select=quot;authors/itemquot;> <li> <xsl:value‐of select=quot;@namequot;/> </li> </xsl:for‐each> </ul> </xsl:variable>
66.
Переменные <xsl:template match=quot;itemquot;> <xsl:param name=quot;classquot;/> <div class=quot;$classquot;> ... </div> </xsl:template> <xsl:apply‐templates select=quot;itemquot;> <xsl:with‐param name=quot;classquot; select=quot;’front’quot;/> </xsl:apply‐templates>
67.
Переменные <xsl:template match=quot;itemquot;> <xsl:param name=quot;classquot;/> <div class=quot;$classquot;> ... </div> </xsl:template> <xsl:apply‐templates select=quot;itemquot;> <xsl:with‐param name=quot;classquot;>front</xsl:with‐param> </xsl:apply‐templates>
68.
Переменные <xsl:variable name=quot;listquot; select=quot;document (‘site‐structure.xml’)quot; /> <xsl:template name=quot;site‐menuquot;> <xsl:for‐each select=quot;$list/sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;text()quot;/> </a> </xsl:for‐each> </xsl:template>
69.
Переменные <xsl:variable name=quot;listquot; select=quot;document (‘http://example.com/structure.xml’)quot; /> <xsl:template name=quot;site‐menuquot;> <xsl:for‐each select=quot;$list/sections/itemquot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;text()quot;/> </a> </xsl:for‐each> </xsl:template>
70.
Ключи <xsl:key name=quot;childrenquot; match=quot;/page/sections/itemquot; use=quot;@parentquot;/> <xsl:template match=quot;/page/sectionsquot;> <xsl:for‐each select=quot;item[not (@parent)]quot;> <a href=quot;{@href}quot;> <xsl:value‐of select=quot;@namequot;/> </a> <xsl:for‐each select=quot;key ('children', @href)quot;> <xsl:value‐of select=quot;@namequot;/> <xsl:if test=quot;position() != last()quot;>, </xsl:if> </xsl:for‐each> </xsl:for‐each> </xsl:template>
71.
Часть 2
Descargar ahora