Tag: standards

XSLT 2.0

The xml summer school is over. i attended talks by jenni tennison and michael kay on xslt 2.0. herewith my rough notes. hopefully they prove useful for someone, even in their rough form.
jenni tennison on xslt 2.0

grouping in sequence: paging in xslt
<xsl:for-each select=”paper” group-starting-with=”paper[position() mod10= 1]”>
<xsl:result-document href=”papers{position()}.html”>
result-element for writing multiple documents
it is possible to access these documents via the href URI (say, from another stylesheet)
stored relative to “base output URI”
implications: no more muenchian grouping!
easier to create indexes, summaries, pagination
xsl functions can be replacements for named templates.
functions for atomic values, named templates for mixed content
xslt 2.0 supports xml 1.1 namespace undeclarations
character substitution to create non-wellformed output. map <%@ mapping to unicode
private area:
@ page language =
unfortunately, all this won’t matter so much since microsoft will not support xslt 2.0
what is xsl:sequence??
squences in xpath 2.0
everything is a sequence, like nodeset() but ordered
implication: much less need for recursive templates, less need for temporary elements
xslt 2.0 doesn’t need the result set extension anymore, results are temporary trees
this means complex transformations can be broken up into multiple steps
create a text node from a sequence:
<xsl:value-of select=”author/surname” separator=”, “/> thomson, tobin
xsl:unparsed-text() similar to document(), but for text nodes.. interesting for includes
parameter changes:
tunnel params: set param high up in the call stack, us it low down, without passing it through explicitly
required param: error if value isnt provided
xsl:next-match calls template that would have matched if the current wouldn’t have been there
match=”a[@id=

xsl:next-match
match=”a”
…¨
using schemas / types may make things easier, not using them may make things harder.

michael kay on schema support in xslt 2.0

much more robust code. put validation into xslt
sequence of strings: multiple lines of text, is not an xml document
for-each select=$lines
“find it useful to always declare types” for debugging
performance?
4 different grouping functions:
group-by
group-adjacent
group-starting-with
group-ending-with
eq was introduced as a simplified = for performance reasons (it only matches once)
, in select? -> , concatenates sequences. is not an OR
select=”current-group() except .” selects the current group except the context node.
except is new in xpath 2.0
this serves as terminating condition for recursive templates too 🙂
<xsl:result-document validation=”strict”> produces the output
concept of output-driven stylesheet versus input-driven. “how should the output look?” -> pull. “how does the input look?” -> push
new: union within xpath: /book/chapter|section/p
–> xsl validation points straight at the source of validation errors, no guesswork which
template produced the wrong output
-> but, when you build up, you want bigger picture. sometimes, turn validation off
input and output schemas
tip: use xsl:key for inverse relationships
“xsl functions are quite object oriented. they operate on the data structure”
if (data($date) instance of StandardDate)
-> convert to ISO. this allows to check for types. allows for fallback!!
standard date would be something like 200-05-03
there could also be: 200? may ??
or even “in the year the jakal ruled”
-> all are valid, but fallback

Designing XML Formats

i’m on a msdn blog spree for a bit. here is dare obasanjo with Designing XML Formats: Versioning vs. Extensibility

Many people designing XML formats whether for application-specific configuration files, website syndication formats or new markup languages have to face the problem of how to design their formats to be extensible and yet be resilient to changes due to changes to versions of the format. One thing I have noticed in talking to various teams at Microsoft and some of our customers is that many people think about extensibility of formats and confuse that for being the same as the versioning problem.

Monorom tribute

I could go insane with the web page behind the discussion board. First I could make it 110% xhtml 1.1 + CSS. Heck, why not xhtml 2.0 just to be extra addictive-personality-disordered. Then I could neatly format all the html code so it’s perfectly indented. But the html is generated by a script, and the script has to be indented correctly so that it’s perfect too, and a correctly indented ASP script does not, by definition, produce correctly indented HTML. So I could write a filter that takes the output of the ASP script and reindents it so that if anybody does a View Source they would see neatly indented HTML and think I have great attention to detail. Then I would start to obsess about all the wasted bandwidth caused by meaningless whitespace in the HTML file, and I’d go back and forth in circles between compressed HTML and nicely laid out HTML, pausing only to shave.

monorom, if i ever give you pain about xml:space and other esoteric issues again. consider the above 🙂

ie 7

IE7 provides Microsoft Internet Explorer with support for W3C standard CSS. It supports the following CSS selectors:
o namespace|selector
o parent > child
o adjacent + sibling
o [attr], [attr=”value”], [attr~=”value”]
o .multiple.classes (fixes bug)
o :first-child, :last-child
o :hover, :active, :focus
o :root

ingenious! the parent > child selector is especially useful. it may even be possible to extend javascript DOM support in internet explorer to make bxe run.