XSLT 3: Clearer, faster, wider, stronger

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.พ. 2025
  • Liam Quin makes a convincing argument for XSLT 3 in our latest webinar. Sign up for the remaining webinars in June at markupuk.org/s....
    Due to the sometimes poor sound quality during the Q&A session, Liam also provided the following:
    XSLT 3: Clearer, faster, wider, stronger
    Question Details
    1 (Joel Kalvesmaki)
    Amazing presentation. Thank you!
    Comments:
    The XSLT specs are opaque when it comes to explaining how to construct and query maps and arrays. I look forward to reviewing your explanation today to understand better.
    My favorite 3.0 innovations: || instead of concat(), Static parameters + @use-when
    Questions:
    Does contains-token() normalize space before doing tokenize(?, ' ')?
    You say EXpath functions are native. Native to what?"
    Liam responded:
    When i give the three-day course version, i ask attendees if they’d be comfortable going to the specs to answer a question; usually at most one or two say yes, but by the end of the course everyone confidently says yes. It’s about understanding the specs invent terms, jargon, so they can do their job accurately, and understanding the specs are for implementors and authors as well as users. So it can take re-reading a few times, but don’t be intimidated.
    Yes, contains-token() works like tokenize with \s+but also handles the HTML collation.
    2 (Elisa Beshero-Bondar)
    Can you provide an example about applying use-when?
    I wasn’t sure I understood the notion of controlling system dependencies when you were introducing this toward the end. Thanks!
    Liam responded:
    Suppose you have bought two different packages that are each interpreters of the Prolog computer language; you might need to have some different templates, or even make changes within templates, depending on which implementation you're using.
    4 (Norman Tovey-Walsh)
    Not a question, but an observation: try/catch makes fn:error() more useful because you can generate and catch application specific errors.
    (As an alternative to xsl:message terminate-yes)
    Liam agrees :)
    5 (Syd Bauman)
    Do the sequence comparators (“=”, “!=”, “>”, etc.) work on arrays? (And if so, how?)
    Liam replies
    Yes but an array is an item, so they don't work as you might think :-) You more likely want to use a “satisfies” expression.
    6 (Rob Walpole)
    Thank you for a great presentation Liam.
    You mentioned early on that we might benefit from structuring our stylesheets in a different way for XSLT 3.
    Could you elaborate on that?
    I mentioned new data structures i think, rather than restructuring, but yes, you might well do things differently: more use of functions, of more complex expressions, and somewhat reduced use of modes and [named] templates.
    7 (Elisa Beshero-Bondar)
    That makes sense, Liam-thanks!
    8 (Norman Tovey-Walsh)
    My favorite use-when trick is an xsl:message with a static variable to control when its output
    9 (Syd Bauman)
    Got it! Thanks.

ความคิดเห็น • 1