Title: Upconversion using XSLT 2.0
1Up-conversionusing XSLT 2.0
- Michael Kay
- XML 2004
- 16 November 2004
2A Plug
3Up-Conversion
- What is it?
- XSLT 2.0 Facilities
- An example
4A Definition
Up-conversion detects implicit structure and
converts it into explicit markup
5Relevant Facilities in XSLT 2.0
- unparsed-text() function
- reads plain text files
- analyze-string
- regex-based string manipulation
- for-each-group
- turns flat element sequences into nested tree
structures - result tree validation
- ensures that the result matches the target schema
6ltxslanalyze-stringgt example
ltxslanalyze-string selectabstract
regex\.?\gt
ltxslmatching-substringgt ltcitationgtltxslvalu
e-of select./gtlt/citationgt
lt/xslmatching-substringgt ltxslnon-matching-sub
stringgt ltxslvalue-of select./gt
lt/xslnon-matching-substringgt lt/xslanalyze-string
gt
7ltxslfor-each-groupgt example
ltxslfor-each-group selectemployee
group-bydepartmentgt
lth2gtltxslvalue-of selectcurrent-grouping-key()/
gtlt/h2gt ltxslfor-each selectcurrent-group()gt
lth3gtEmployee ltxslvalue-of
selectname/gtlt/h3gt lttablegt
ltxslfor-each select except (name,
department) gt lttrgt
lttdgtltxslvalue-of selectname()/gtlt/tdgt
lttdgtltxslvalue-of select./gtlt/tdgt
lt/trgt lt/xslfor-eachgt lt/tablegt
lt/xslfor-eachgt lt/xslfor-each-groupgt
8A Case Study
XHTML
GEDCOM5.5legacydata
GEDCOM5.5encoded in XML
GEDCOM6.0
PDF
c
GEDCOM6.0Schema
9Summary
- Up-conversion converts implicit structure to
explicit markup - Supported by
- unparsed-text()
- xslanalyze-string
- xslfor-each-group
- result tree validation
- Extends the reach of XSLT as a tool