xslt

Parse XSLT.

In this module:

Language

Name (Aliases)

Description

Filename(s)

Mime Type(s)

Xslt

XSLT (xslt, xsl)

Extensible Stylesheet Language Transformations

*.xsl, *.xslt, *.xpl

application/xsl+xml, application/xslt+xml, text/xsl, text/xslt

class Xslt[source]

Bases: parce.lang.xml.Xml

Xslt is also valid Xml, give Xslt tags the Keyword action.

classmethod tag_action()[source]

Reimplemented to return Keyword for known Xslt tag names.

Example:

Root lexicon Xslt.root and text:

Text rendered using default theme

<?xml version="1.0" encoding="UTF-8"?>
<!-- XSLT example from WikiPedia -->
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns="http://www.w3.org/1999/xhtml">

  <xsl:output method="xml" indent="yes" encoding="UTF-8"/>

  <xsl:template match="/persons">
    <html>
      <head> <title>Testing XML Example</title> </head>
      <body>
        <h1>Persons</h1>
        <ul>
          <xsl:apply-templates select="person">
            <xsl:sort select="family-name" />
          </xsl:apply-templates>
        </ul>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="person">
    <li>
      <xsl:value-of select="family-name"/><xsl:text>, </xsl:text><xsl:value-of select="name"/>
    </li>
  </xsl:template>

</xsl:stylesheet>

Result tree:

<Context Xslt.root at 0-781 (12 children)>
 ├╴<Token '<?' at 0:2 (Delimiter.Bracket.Preprocessed.Start)>
 ├╴<Token 'xml' at 2:5 (Name.Tag.Preprocessed)>
 ├╴<Context Xslt.processing_instruction at 5-38 (11 children)>
 │  ├╴<Token ' ' at 5:6 (Text.Preprocessed)>
 │  ├╴<Token 'version' at 6:13 (Name.Attribute)>
 │  ├╴<Token '=' at 13:14 (Delimiter.Operator)>
 │  ├╴<Token '"' at 14:15 (Literal.String.Double.Start)>
 │  ├╴<Context Xslt.dqstring at 15-19 (2 children)>
 │  │  ├╴<Token '1.0' at 15:18 (Literal.String.Double)>
 │  │  ╰╴<Token '"' at 18:19 (Literal.String.Double.End)>
 │  ├╴<Token ' ' at 19:20 (Text.Preprocessed)>
 │  ├╴<Token 'encoding' at 20:28 (Name.Attribute)>
 │  ├╴<Token '=' at 28:29 (Delimiter.Operator)>
 │  ├╴<Token '"' at 29:30 (Literal.String.Double.Start)>
 │  ├╴<Context Xslt.dqstring at 30-36 (2 children)>
 │  │  ├╴<Token 'UTF-8' at 30:35 (Literal.String.Double)>
 │  │  ╰╴<Token '"' at 35:36 (Literal.String.Double.End)>
 │  ╰╴<Token '?>' at 36:38 (Delimiter.Bracket.Preprocessed.End)>
 ├╴<Token '\n' at 38:39 (Whitespace)>
 ├╴<Token '<!--' at 39:43 (Comment.Start)>
 ├╴<Context Xslt.comment at 43-75 (2 children)>
 │  ├╴<Token ' XSLT exampl...om WikiPedia ' at 43:72 (Comment)>
 │  ╰╴<Token '-->' at 72:75 (Comment.End)>
 ├╴<Token '\n' at 75:76 (Whitespace)>
 ├╴<Token '<' at 76:77 (Delimiter)>
 ├╴<Token 'xsl:stylesheet' at 77:91 (Keyword)>
 ├╴<Context Xslt.attrs at 94-198 (13 children)>
 │  ├╴<Token 'version' at 94:101 (Name.Attribute)>
 │  ├╴<Token '=' at 101:102 (Delimiter.Operator)>
 │  ├╴<Token '"' at 102:103 (Literal.String.Double.Start)>
 │  ├╴<Context Xslt.dqstring at 103-107 (2 children)>
 │  │  ├╴<Token '1.0' at 103:106 (Literal.String.Double)>
 │  │  ╰╴<Token '"' at 106:107 (Literal.String.Double.End)>
 │  ├╴<Token 'xmlns:xsl' at 110:119 (Name.Attribute)>
 │  ├╴<Token '=' at 119:120 (Delimiter.Operator)>
 │  ├╴<Token '"' at 120:121 (Literal.String.Double.Start)>
 │  ├╴<Context Xslt.dqstring at 121-158 (2 children)>
 │  │  ├╴<Token 'http://www.w...XSL/Transform' at 121:157 (Literal.String.Double)>
 │  │  ╰╴<Token '"' at 157:158 (Literal.String.Double.End)>
 │  ├╴<Token 'xmlns' at 161:166 (Name.Attribute)>
 │  ├╴<Token '=' at 166:167 (Delimiter.Operator)>
 │  ├╴<Token '"' at 167:168 (Literal.String.Double.Start)>
 │  ├╴<Context Xslt.dqstring at 168-197 (2 children)>
 │  │  ├╴<Token 'http://www.w3.org/1999/xhtml' at 168:196 (Literal.String.Double)>
 │  │  ╰╴<Token '"' at 196:197 (Literal.String.Double.End)>
 │  ╰╴<Token '>' at 197:198 (Delimiter)>
 ├╴<Context Xslt.tag at 198-780 (18 children)>
 │  ├╴<Token '\n\n  ' at 198:202 (Whitespace)>
 │  ├╴<Token '<' at 202:203 (Delimiter)>
 │  ├╴<Token 'xsl:output' at 203:213 (Keyword)>
 │  ├╴<Context Xslt.attrs at 214-258 (13 children)>
 │  │  ├╴<Token 'method' at 214:220 (Name.Attribute)>
 │  │  ├╴<Token '=' at 220:221 (Delimiter.Operator)>
 │  │  ├╴<Token '"' at 221:222 (Literal.String.Double.Start)>
 │  │  ├╴<Context Xslt.dqstring at 222-226 (2 children)>
 │  │  │  ├╴<Token 'xml' at 222:225 (Literal.String.Double)>
 │  │  │  ╰╴<Token '"' at 225:226 (Literal.String.Double.End)>
 │  │  ├╴<Token 'indent' at 227:233 (Name.Attribute)>
 │  │  ├╴<Token '=' at 233:234 (Delimiter.Operator)>
 │  │  ├╴<Token '"' at 234:235 (Literal.String.Double.Start)>
 │  │  ├╴<Context Xslt.dqstring at 235-239 (2 children)>
 │  │  │  ├╴<Token 'yes' at 235:238 (Literal.String.Double)>
 │  │  │  ╰╴<Token '"' at 238:239 (Literal.String.Double.End)>
 │  │  ├╴<Token 'encoding' at 240:248 (Name.Attribute)>
 │  │  ├╴<Token '=' at 248:249 (Delimiter.Operator)>
 │  │  ├╴<Token '"' at 249:250 (Literal.String.Double.Start)>
 │  │  ├╴<Context Xslt.dqstring at 250-256 (2 children)>
 │  │  │  ├╴<Token 'UTF-8' at 250:255 (Literal.String.Double)>
 │  │  │  ╰╴<Token '"' at 255:256 (Literal.String.Double.End)>
 │  │  ╰╴<Token '/>' at 256:258 (Delimiter)>
 │  ├╴<Token '\n\n  ' at 258:262 (Whitespace)>
 │  ├╴<Token '<' at 262:263 (Delimiter)>
 │  ├╴<Token 'xsl:template' at 263:275 (Keyword)>
 │  ├╴<Context Xslt.attrs at 276-293 (5 children)>
 │  │  ├╴<Token 'match' at 276:281 (Name.Attribute)>
 │  │  ├╴<Token '=' at 281:282 (Delimiter.Operator)>
 │  │  ├╴<Token '"' at 282:283 (Literal.String.Double.Start)>
 │  │  ├╴<Context Xslt.dqstring at 283-292 (2 children)>
 │  │  │  ├╴<Token '/persons' at 283:291 (Literal.String.Double)>
 │  │  │  ╰╴<Token '"' at 291:292 (Literal.String.Double.End)>
 │  │  ╰╴<Token '>' at 292:293 (Delimiter)>
 │  ├╴<Context Xslt.tag at 293-596 (9 children)>
 │  │  ├╴<Token '\n    ' at 293:298 (Whitespace)>
 │  │  ├╴<Token '<' at 298:299 (Delimiter)>
 │  │  ├╴<Token 'html' at 299:303 (Name.Tag)>
 │  │  ├╴<Token '>' at 303:304 (Delimiter)>
 │  │  ├╴<Context Xslt.tag at 304-578 (14 children)>
 │  │  │  ├╴<Token '\n      ' at 304:311 (Whitespace)>
 │  │  │  ├╴<Token '<' at 311:312 (Delimiter)>
 │  │  │  ├╴<Token 'head' at 312:316 (Name.Tag)>
 │  │  │  ├╴<Token '>' at 316:317 (Delimiter)>
 │  │  │  ├╴<Context Xslt.tag at 317-360 (9 children)>
 │  │  │  │  ├╴<Token ' ' at 317:318 (Whitespace)>
 │  │  │  │  ├╴<Token '<' at 318:319 (Delimiter)>
 │  │  │  │  ├╴<Token 'title' at 319:324 (Name.Tag)>
 │  │  │  │  ├╴<Token '>' at 324:325 (Delimiter)>
 │  │  │  │  ├╴<Context Xslt.tag at 325-352 (4 children)>
 │  │  │  │  │  ├╴<Token 'Testing XML Example' at 325:344 (Text)>
 │  │  │  │  │  ├╴<Token '</' at 344:346 (Delimiter)>
 │  │  │  │  │  ├╴<Token 'title' at 346:351 (Name.Tag)>
 │  │  │  │  │  ╰╴<Token '>' at 351:352 (Delimiter)>
 │  │  │  │  ├╴<Token ' ' at 352:353 (Whitespace)>
 │  │  │  │  ├╴<Token '</' at 353:355 (Delimiter)>
 │  │  │  │  ├╴<Token 'head' at 355:359 (Name.Tag)>
 │  │  │  │  ╰╴<Token '>' at 359:360 (Delimiter)>
 │  │  │  ├╴<Token '\n      ' at 360:367 (Whitespace)>
 │  │  │  ├╴<Token '<' at 367:368 (Delimiter)>
 │  │  │  ├╴<Token 'body' at 368:372 (Name.Tag)>
 │  │  │  ├╴<Token '>' at 372:373 (Delimiter)>
 │  │  │  ├╴<Context Xslt.tag at 373-566 (14 children)>
 │  │  │  │  ├╴<Token '\n        ' at 373:382 (Whitespace)>
 │  │  │  │  ├╴<Token '<' at 382:383 (Delimiter)>
 │  │  │  │  ├╴<Token 'h1' at 383:385 (Name.Tag)>
 │  │  │  │  ├╴<Token '>' at 385:386 (Delimiter)>
 │  │  │  │  ├╴<Context Xslt.tag at 386-398 (4 children)>
 │  │  │  │  │  ├╴<Token 'Persons' at 386:393 (Text)>
 │  │  │  │  │  ├╴<Token '</' at 393:395 (Delimiter)>
 │  │  │  │  │  ├╴<Token 'h1' at 395:397 (Name.Tag)>
 │  │  │  │  │  ╰╴<Token '>' at 397:398 (Delimiter)>
 │  │  │  │  ├╴<Token '\n        ' at 398:407 (Whitespace)>
 │  │  │  │  ├╴<Token '<' at 407:408 (Delimiter)>
 │  │  │  │  ├╴<Token 'ul' at 408:410 (Name.Tag)>
 │  │  │  │  ├╴<Token '>' at 410:411 (Delimiter)>
 │  │  │  │  ├╴<Context Xslt.tag at 411-552 (9 children)>
 │  │  │  │  │  ├╴<Token '\n          ' at 411:422 (Whitespace)>
 │  │  │  │  │  ├╴<Token '<' at 422:423 (Delimiter)>
 │  │  │  │  │  ├╴<Token 'xsl:apply-templates' at 423:442 (Keyword)>
 │  │  │  │  │  ├╴<Context Xslt.attrs at 443-459 (5 children)>
 │  │  │  │  │  │  ├╴<Token 'select' at 443:449 (Name.Attribute)>
 │  │  │  │  │  │  ├╴<Token '=' at 449:450 (Delimiter.Operator)>
 │  │  │  │  │  │  ├╴<Token '"' at 450:451 (Literal.String.Double.Start)>
 │  │  │  │  │  │  ├╴<Context Xslt.dqstring at 451-458 (2 children)>
 │  │  │  │  │  │  │  ├╴<Token 'person' at 451:457 (Literal.String.Double)>
 │  │  │  │  │  │  │  ╰╴<Token '"' at 457:458 (Literal.String.Double.End)>
 │  │  │  │  │  │  ╰╴<Token '>' at 458:459 (Delimiter)>
 │  │  │  │  │  ├╴<Context Xslt.tag at 459-538 (8 children)>
 │  │  │  │  │  │  ├╴<Token '\n            ' at 459:472 (Whitespace)>
 │  │  │  │  │  │  ├╴<Token '<' at 472:473 (Delimiter)>
 │  │  │  │  │  │  ├╴<Token 'xsl:sort' at 473:481 (Keyword)>
 │  │  │  │  │  │  ├╴<Context Xslt.attrs at 482-505 (5 children)>
 │  │  │  │  │  │  │  ├╴<Token 'select' at 482:488 (Name.Attribute)>
 │  │  │  │  │  │  │  ├╴<Token '=' at 488:489 (Delimiter.Operator)>
 │  │  │  │  │  │  │  ├╴<Token '"' at 489:490 (Literal.String.Double.Start)>
 │  │  │  │  │  │  │  ├╴<Context Xslt.dqstring at 490-502 (2 children)>
 │  │  │  │  │  │  │  │  ├╴<Token 'family-name' at 490:501 (Literal.String.Double)>
 │  │  │  │  │  │  │  │  ╰╴<Token '"' at 501:502 (Literal.String.Double.End)>
 │  │  │  │  │  │  │  ╰╴<Token '/>' at 503:505 (Delimiter)>
 │  │  │  │  │  │  ├╴<Token '\n          ' at 505:516 (Whitespace)>
 │  │  │  │  │  │  ├╴<Token '</' at 516:518 (Delimiter)>
 │  │  │  │  │  │  ├╴<Token 'xsl:apply-templates' at 518:537 (Keyword)>
 │  │  │  │  │  │  ╰╴<Token '>' at 537:538 (Delimiter)>
 │  │  │  │  │  ├╴<Token '\n        ' at 538:547 (Whitespace)>
 │  │  │  │  │  ├╴<Token '</' at 547:549 (Delimiter)>
 │  │  │  │  │  ├╴<Token 'ul' at 549:551 (Name.Tag)>
 │  │  │  │  │  ╰╴<Token '>' at 551:552 (Delimiter)>
 │  │  │  │  ├╴<Token '\n      ' at 552:559 (Whitespace)>
 │  │  │  │  ├╴<Token '</' at 559:561 (Delimiter)>
 │  │  │  │  ├╴<Token 'body' at 561:565 (Name.Tag)>
 │  │  │  │  ╰╴<Token '>' at 565:566 (Delimiter)>
 │  │  │  ├╴<Token '\n    ' at 566:571 (Whitespace)>
 │  │  │  ├╴<Token '</' at 571:573 (Delimiter)>
 │  │  │  ├╴<Token 'html' at 573:577 (Name.Tag)>
 │  │  │  ╰╴<Token '>' at 577:578 (Delimiter)>
 │  │  ├╴<Token '\n  ' at 578:581 (Whitespace)>
 │  │  ├╴<Token '</' at 581:583 (Delimiter)>
 │  │  ├╴<Token 'xsl:template' at 583:595 (Keyword)>
 │  │  ╰╴<Token '>' at 595:596 (Delimiter)>
 │  ├╴<Token '\n\n  ' at 596:600 (Whitespace)>
 │  ├╴<Token '<' at 600:601 (Delimiter)>
 │  ├╴<Token 'xsl:template' at 601:613 (Keyword)>
 │  ├╴<Context Xslt.attrs at 614-629 (5 children)>
 │  │  ├╴<Token 'match' at 614:619 (Name.Attribute)>
 │  │  ├╴<Token '=' at 619:620 (Delimiter.Operator)>
 │  │  ├╴<Token '"' at 620:621 (Literal.String.Double.Start)>
 │  │  ├╴<Context Xslt.dqstring at 621-628 (2 children)>
 │  │  │  ├╴<Token 'person' at 621:627 (Literal.String.Double)>
 │  │  │  ╰╴<Token '"' at 627:628 (Literal.String.Double.End)>
 │  │  ╰╴<Token '>' at 628:629 (Delimiter)>
 │  ├╴<Context Xslt.tag at 629-761 (9 children)>
 │  │  ├╴<Token '\n    ' at 629:634 (Whitespace)>
 │  │  ├╴<Token '<' at 634:635 (Delimiter)>
 │  │  ├╴<Token 'li' at 635:637 (Name.Tag)>
 │  │  ├╴<Token '>' at 637:638 (Delimiter)>
 │  │  ├╴<Context Xslt.tag at 638-743 (15 children)>
 │  │  │  ├╴<Token '\n      ' at 638:645 (Whitespace)>
 │  │  │  ├╴<Token '<' at 645:646 (Delimiter)>
 │  │  │  ├╴<Token 'xsl:value-of' at 646:658 (Keyword)>
 │  │  │  ├╴<Context Xslt.attrs at 659-681 (5 children)>
 │  │  │  │  ├╴<Token 'select' at 659:665 (Name.Attribute)>
 │  │  │  │  ├╴<Token '=' at 665:666 (Delimiter.Operator)>
 │  │  │  │  ├╴<Token '"' at 666:667 (Literal.String.Double.Start)>
 │  │  │  │  ├╴<Context Xslt.dqstring at 667-679 (2 children)>
 │  │  │  │  │  ├╴<Token 'family-name' at 667:678 (Literal.String.Double)>
 │  │  │  │  │  ╰╴<Token '"' at 678:679 (Literal.String.Double.End)>
 │  │  │  │  ╰╴<Token '/>' at 679:681 (Delimiter)>
 │  │  │  ├╴<Token '<' at 681:682 (Delimiter)>
 │  │  │  ├╴<Token 'xsl:text' at 682:690 (Keyword)>
 │  │  │  ├╴<Token '>' at 690:691 (Delimiter)>
 │  │  │  ├╴<Context Xslt.tag at 691-704 (4 children)>
 │  │  │  │  ├╴<Token ', ' at 691:693 (Text)>
 │  │  │  │  ├╴<Token '</' at 693:695 (Delimiter)>
 │  │  │  │  ├╴<Token 'xsl:text' at 695:703 (Keyword)>
 │  │  │  │  ╰╴<Token '>' at 703:704 (Delimiter)>
 │  │  │  ├╴<Token '<' at 704:705 (Delimiter)>
 │  │  │  ├╴<Token 'xsl:value-of' at 705:717 (Keyword)>
 │  │  │  ├╴<Context Xslt.attrs at 718-733 (5 children)>
 │  │  │  │  ├╴<Token 'select' at 718:724 (Name.Attribute)>
 │  │  │  │  ├╴<Token '=' at 724:725 (Delimiter.Operator)>
 │  │  │  │  ├╴<Token '"' at 725:726 (Literal.String.Double.Start)>
 │  │  │  │  ├╴<Context Xslt.dqstring at 726-731 (2 children)>
 │  │  │  │  │  ├╴<Token 'name' at 726:730 (Literal.String.Double)>
 │  │  │  │  │  ╰╴<Token '"' at 730:731 (Literal.String.Double.End)>
 │  │  │  │  ╰╴<Token '/>' at 731:733 (Delimiter)>
 │  │  │  ├╴<Token '\n    ' at 733:738 (Whitespace)>
 │  │  │  ├╴<Token '</' at 738:740 (Delimiter)>
 │  │  │  ├╴<Token 'li' at 740:742 (Name.Tag)>
 │  │  │  ╰╴<Token '>' at 742:743 (Delimiter)>
 │  │  ├╴<Token '\n  ' at 743:746 (Whitespace)>
 │  │  ├╴<Token '</' at 746:748 (Delimiter)>
 │  │  ├╴<Token 'xsl:template' at 748:760 (Keyword)>
 │  │  ╰╴<Token '>' at 760:761 (Delimiter)>
 │  ├╴<Token '\n\n' at 761:763 (Whitespace)>
 │  ├╴<Token '</' at 763:765 (Delimiter)>
 │  ├╴<Token 'xsl:stylesheet' at 765:779 (Keyword)>
 │  ╰╴<Token '>' at 779:780 (Delimiter)>
 ╰╴<Token '\n' at 780:781 (Whitespace)>