Skip to content

ipetropolsky/xslt-intro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Материалы к лекции по XSLT

Школа программистов HeadHunter 2017-2018

В примерах есть шаблоны для разных XML-файлов.

Первое слово в названии шаблона — это имя XML, к которому его применять.

xsltproc xsl/01-hello-no-templates.xsl xml/hello.xml
xsltproc xsl/02-hello.xsl xml/hello.xml
xsltproc xsl/03-hello-creation.xsl xml/hello.xml
xsltproc xsl/04-account-control.xsl xml/account.xml
xsltproc xsl/05-account-call.xsl xml/account.xml
xsltproc xsl/06-hello-copy.xsl xml/hello.xml
xsltproc xsl/06-hello-filter.xsl xml/hello.xml
xsltproc xsl/06-hello-proxy.xsl xml/hello.xml
xsltproc xsl/07-hello-proxy-import.xsl xml/hello.xml
xsltproc xsl/08-account-priority.xsl xml/account.xml # инструкция внутри
xsltproc xsl/09-account-modes.xsl xml/account.xml
xsltproc xsl/10-hello-variable.xsl xml/hello.xml
xsltproc xsl/11-hello-params.xsl xml/hello.xml
xsltproc xsl/12-account-sort.xsl xml/account.xml
xsltproc xsl/13-account-key.xsl xml/account.xml
xsltproc xsl/14-hello-attribute.xsl xml/hello.xml
xsltproc xsl/15-account-urls.xsl xml/account.xml

Для работы в консоли понадобится libxml2 и libxslt, трансформация запускается так: xsltproc template.xsl input.xml.

Можно смотреть результат трансформации в браузере. Для этого нужно:

  1. Добавить в XML после пролога подключение таблицы стилей:
<?xml-stylesheet type="text/xsl" href="/xsl/04-account-control.xsl"?>
  1. Запустить http-сервер в папке с XML и XSL, например так: python -m SimpleHTTPServer 8087 (порт любой).
  2. Открыть в браузере XML: https://locaalhost:8087/xml/account-browser.xml.

Домашнее задание

https://gist.github.com/ipetropolsky/8cd9c52793a7896bddbabd881107980c

Можно форкнуть этот репозиторий и сделать пулл-реквест в мастер, положив задание в /homework.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages