A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.
-
Upload
anthony-benson -
Category
Documents
-
view
215 -
download
0
Transcript of A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.
![Page 1: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/1.jpg)
A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules
Terry BradyLexisNexis
![Page 2: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/2.jpg)
Problem to Solve Collaborative XSLT Development Create useful modules that will
operate in multiple data conversions Multiple Input DTD’s Multiple Output DTD’s Team does not consist of schema
“experts”
![Page 3: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/3.jpg)
Challenge Xslt containment not as easy as OO
containment Import precedence is trickier than
you think! Construction of the import tree can
radically alter the behavior of individual modules
Difficult to validate to multiple targets
![Page 4: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/4.jpg)
XSLT Use Great for conversions Requires a shift in mind set Testing capabilities
Full support not there Or, so counter-intuitive everyone must
solve on their own
![Page 5: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/5.jpg)
XSLT Modularity xsl:import
Creates import tree Import precedence overrides other precedence Great for named templates
xsl:include Creates a single logical module Precedence:
match specificity priority Position
Challenge with named templates!
![Page 6: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/6.jpg)
Very Contrived Examples Input DTD’s
article.dtd instructions.dtd
Output DTD’s book.dtd faq.dtd
![Page 7: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/7.jpg)
Article art:article
(in:title , in:section+) in:title
(#PCDATA|in:emph|meta:edit-by | meta:edit-date)* in:section
(in:title? , (in:para+ | in:section+)) in:para
(#PCDATA | in:emph | meta:edit-by | meta:edit-date)* in:emph
(#PCDATA | meta:edit-by | meta:edit-date)* meta:edit-by
(#PCDATA) meta:edit-date
(#PCDATA)
![Page 8: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/8.jpg)
Instructions man:manual
(in:title , (in:section+ | man:step+)) in:title
(#PCDATA|in:emph | meta:edit-by | meta:edit-date)* in:section
(in:title? , (in:para+ | in:section+ | man:step+))> man:step
(man:num , in:para+) in:para
(#PCDATA | in:emph | meta:edit-by | meta:edit-date)* in:emph
(#PCDATA | meta:edit-by | meta:edit-date)* meta:edit-by
(#PCDATA) meta:edit-date
(#PCDATA) man:num
(#PCDATA)
![Page 9: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/9.jpg)
Book book:book
(out:label? , out:header , out:section+) out:header
(#PCDATA|out:italics)* out:section
(out:label? , out:header? , (out:section | out:para)+) out:para
(#PCDATA | out:italics)* out:italics
(#PCDATA) out:label
(#PCDATA)
![Page 10: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/10.jpg)
Faq faq:faq
(out:label? , out:header , out:section+) out:header
(#PCDATA|out:italics)* out:section
(out:label? , out:header? , out:para+) out:para
(#PCDATA | out:italics)* out:italics
(#PCDATA) out:label
(#PCDATA)
![Page 11: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/11.jpg)
Modules NeededGeneral (default/meta)
title
paragraph
section
step
makebook
makefaq
default rule, warn on unmapped elements
In:title out:header in:para & in:emph in:sectionout:section man:step/man:num root book:book root faq:faq
![Page 12: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/12.jpg)
Module Imports makebook.xsl imports section.xsl makefaq.xsl imports section.xsl
para.xsl imports general.xsl
section.xsl imports para.xsl, title.xsl, step.xsl
step.xsl imports para.xsl
title.xsl imports general.xsl
![Page 13: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/13.jpg)
Create Use Cases Only as complex as needed to
illustrate one case Validate understanding before
coding
![Page 14: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/14.jpg)
Create Contrived Use Cases Title Paragraph Section Step Article Manual
![Page 15: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/15.jpg)
Title Use Case<?xml version='1.0' ?>
<?use-case scenario=Simple title;;stylesheet=stylesheets/demo/title.xsl?>
<!DOCTYPE in:title SYSTEM "../article.dtd">
<in:title>Hello</in:title>
![Page 16: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/16.jpg)
Title with Metadata<?xml version="1.0" encoding="utf-8"?><!DOCTYPE in:title SYSTEM "../article.dtd"><?use-case scenario=Title with
metadata;;stylesheet=stylesheets/demo/title.xsl?>
<in:title>Hello<meta:edit-by>Terry</meta:edit-by><meta:edit-date>1/1/2006</meta:edit-date>
</in:title>
![Page 17: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/17.jpg)
Create stylesheets Determine import hierarchy in
advance Call <xsl:apply-templates/>
wherever possible to allow the DTD to change
Iteratively test with use cases. Validate to DTD and schematron as
an additional tool.
![Page 18: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/18.jpg)
Import Precedence Issue in:title processed fine by title.xsl in:para processed fine by para.xsl When executing the same files with
section.xsl in:para processed fine In:title processed by default rule
![Page 19: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/19.jpg)
Introduce “template files” Construct the import tree as needed
for production Modular components reference a
“template file” via a processing instruction Inclusion of default rule Inclusive set of namespace declarations Testing-specific match rules
![Page 20: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/20.jpg)
New import strategy makebook.xsl imports general.xsl, section.xsl makefaq.xsl imports general.xsl, section.xsl section.xsl imports para.xsl, title.xsl, step.xsl
References template.xsl via pi step.xsl imports para.xsl
References template.xsl via pi template.xsl imports general.xsl
![Page 21: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/21.jpg)
Other Challenges Validating output of common
modules to multiple target DTD’s Supporting use cases appropriate to
a subset of target DTD’s Viewing results
![Page 22: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/22.jpg)
Unit Test Driver
Use Case Files
StylesheetsBaselineoutput
Source Code Management
Runtime Directory
Use Case FilesUse Case
Files
BaselineoutputBaseline
output
Schematron, & Template
DTD
![Page 23: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/23.jpg)
Copy Resources to runtime areaSource Code Management
Use Case Files
StylesheetsBaselineoutput
Runtime Directory
Use Case FilesUse Case
Files
BaselineoutputBaseline
output
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Schematron, & Template
DTD
Schematron, & Template
DTD
![Page 24: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/24.jpg)
Iterate over use case filesRuntime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Schematron, & Template
DTD
![Page 25: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/25.jpg)
Runtime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Use Case File Copy
Schematron, & Template
DTD
This makes it easier to view the input file in a browser that is not catalog aware
Copy use case file with fully resolved DTD (if using catalog)
![Page 26: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/26.jpg)
Report the validity of use case fileRuntime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Schematron, & Template
DTD
![Page 27: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/27.jpg)
Find each stylesheet referenced by the use case file…
Runtime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Schematron, & Template
DTD
A single use case could serve as input to multiple
stylesheets
![Page 28: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/28.jpg)
If the stylesheet references a template, compile a new stylesheet.
Runtime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Compiledstylesheet
Schematron, & Template
DTD
This is to allow the creation of a custom import tree
when testing an individual module
![Page 29: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/29.jpg)
If the stylesheet references a schematron file, compile the schematron and perform semantic validation on the use case file.
Runtime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
CompiledSchematron
Compiledstylesheet
Schematron, & Template
DTD
This permits the enforcement of
boundary/scope conditions for a styesheet.
![Page 30: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/30.jpg)
For each dtd referenced in the use case file or stylesheet, apply the stylesheet to the use case file.
Runtime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Outputfile
DTDSchematron,Template, &
DTD
Compiledstylesheet
Set the system identifier of the output file to the referenced DTD.
Validate transformation output to all appropriate targets
![Page 31: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/31.jpg)
Report on the validity of the output file.
Runtime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Outputfile
DTDSchematron,Template, &
DTD
Compiledstylesheet
Set the system identifier of the output file to the referenced DTD.
![Page 32: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/32.jpg)
Apply transformation to use case file without referencing an output DTD.
Runtime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Outputfile
Schematron,Template, &
DTD
Compiledstylesheet
DTD
![Page 33: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/33.jpg)
If a use case file references a schematron, compile the schematron and perform semantic validation on the output file.
Runtime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Outputfile
Schematron,Template, &
DTD
CompiledSchematron
![Page 34: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/34.jpg)
If a baseline file exists that matches the output file, perform a comparison of the two files.
Runtime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Outputfile
Schematron,Template, &
DTD
![Page 35: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/35.jpg)
Generate a summary report of test execution
Runtime Directory
Use Case Files
StylesheetsBaselineoutputUse Case
FilesUse Case Files
BaselineoutputBaseline
output
Schematron,Template, &
DTD
SummaryReport
![Page 36: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/36.jpg)
Summary ReportError Statistics
Use case file hierarchyTree Structure Hypertext to resourcesError messages
Input File Output File
Stylesheet, DTD, Schematron
![Page 37: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/37.jpg)
Summary of methodology System architect defines stylesheet
modules Developer is assigned a module. Developer creates use case files. Use cases are reviewed Developer iteratively creates XSLT
module Stylesheet and output files are reviewed Output is "baselined“
![Page 38: A Use-Case Driven Approach to the Development of Reusable Stylesheet Modules Terry Brady LexisNexis.](https://reader035.fdocuments.net/reader035/viewer/2022062722/56649f345503460f94c50eb4/html5/thumbnails/38.jpg)
Benefits Scope is defined for developer Developer demonstrates understanding
immediately Use case files serve as communication
tool Architect does not simply state
constraints. Constraints are enforced Regression test is built during
development