-
Notifications
You must be signed in to change notification settings - Fork 24
Scoreboard HTML Transformations
As described at Scoreboard Implementation and Scoreboard HTML Configuration, the HTML scoreboard pages generated by PC² are created by applying XSL Transformations (XSLT) to an XML standings document string generated by class DefaultScoringAlgorithm
. PC² classes which apply XSL Transformations to XML standings in this way include pc2.core.XMLUtilities
, pc2.ui.StandingsHTMLPane
, pc2.ui.board.ScoreboardCommon
, and multiple classes in package pc2.core.report
.
In all cases, applying XSL Transformations is accomplished by creating an instance of class pc2.core.util.XSLTransformer
. This class defines a variety of public transform()
methods which take as input different types defining an XSL file, an XML string, and an output destination, and apply the transformation specified in the XSL file to the specified XML string, placing the results in the specified output destination.
Internally, the pc2.core.util.XSLTransformer
class uses the Java class javax.xml.transform.TransformerFactory
to construct a new TransformerFactory
, installs the specified XSL transformation into that factory, and then invokes the factory's transform()
method to transform the specified XML into output stored at the specified output location.
The XSLTransformer
class has a main()
method, which allows it to be used for stand-alone testing of XSL files. It expects three arguments: (1) the name of an XSL file; (2) the name of an XML file; and (3) the name of an output file. Running edu.csus.ecs.pc2.core.util.XSLTransformer
as a Java class and providing it with these arguments will cause it to apply the XSL transformations in the specified XSL file to the XML standings contained in the specified XML file and store the result in the specified output file.