ACG 4401 XSLT Extensible Stylesheet Language for Transformations Presenting XML and XBRL

Embed Size (px)

Text of ACG 4401 XSLT Extensible Stylesheet Language for Transformations Presenting XML and XBRL

  • ACG 4401XSLTExtensible Stylesheet Language for TransformationsPresenting XML and XBRL

  • XSLTExtensibleHey its based on XMLStylesheetWhat the data will look likeLanguageScriptingTransformationsReuse, Repurpose, calculate, sort, etc.

  • XSLT PartsXSLTransform Instance Document to different FormHTML, XHTML, XML (new), PDFXSLFOFor formatting data

  • Re-PurposeThe main benefit of XML / XBRLReusability of Data contained in Instance DocumentWe need a method of presenting the dataPresentation LinkbaseXSLT

  • A UBL Catalogue Node TreeCatalogueIDNameIssueDate+ProviderParty+ReceiverParty+CatalogueLineLeaf NodesBranch NodesPartyPartyNameName

  • Transformation Requires xml code in Two DocumentsInstance Document2nd Prolog line linking instance document to XSLT documentXSLT DocumentContains script for selecting elements to be displayed

  • XSLT2 Inputs:Instance & XSLTProcessingBrowserXML ProcessorXMLInstancedocumentXSLTInstructionsXMLResultdocumentMust have 2nd prolog linking to .xsl

  • Transforming your Instance DocumentContain elements and data but..Do NOT contain formatting informationAdd an additional prolog statementConnects your .xml to your .xsl document

    xml-stylesheetTells the processor to use the stylesheet file to transform the data in the .xml documenthref=Points to location of .xsl document.

  • XSLT (the XML code)Root Elementnamespace declaration

    All other namespaces used in the instance document (MUST MATCH)Default namespaces (e.g. without the prefix) are not allowed in XSLT v 1.0Need to make up a prefixDont forget this!

  • XSLT Scripting CodeElements used:templatesfor-eachvalue-ofFunctionsFormattingFormat-numberSumMathematical Operations+, -, *, div

  • TemplatesLine that follows root elementWhat elements from .xml are being used?Templates provide answerProcessing Elements from Instance against Template created in XSLT

    / = Look in entire source document

  • How to transform data containerTells processor transformation will use html tags.Remaining code between and code is the data to be transformed and the formatting code for the transformation

  • Basketball12345 12.5025.00

  • value-ofSelects and transforms/formatsDisplays the value of the selected elementAt the end of the nodeBased on select attributeYou must point to the node you want displayedFull node pathInventory/InventoryItem/IdNumber = 12345//elementnameUsed when one and only one element has the nameStart at root and look for element name.

    Value-of select can use a function.....

  • FunctionsNumericceiling()floor()number()round()sum()Stringconcat()contains()normalize-space()starts-with()string()string-length()substring()substring-after()substring-before()translate()

  • format() functionformat-number attribute has two argumentsNumberPattern (see formatting patterns)


  • Formatting Numbers 0 A digit. # A digit, zero shows as absent.$ prefix. (period) Placeholder for decimal separator., Placeholder for grouping separator.; Separate formats.- Default prefix for negative.% Multiply by 100 and show as a percentage.X Any other characters can be used in the prefix or suffix. Used to quote special characters in a prefix or suffix.

  • for-each loopSelectsAll elements contained in a node-setNode-set is declared with select attributeAdditional .xsl code provide instructions for what to do with selected dataWhat transformations to makeHTML, and XSL tags combined.

  • Accessing Remote Instance Docsdocument() function

  • Output (HTML)

    Transformation will be to an HTML doc.

    All tags must be closed!

  • Defining Tables in HTML

    Tells browser to begin making a tabl

    Tells browser to insert a new row

    Tells browser to use text as heading (1st row)

    Tells browser to insert a new column in the new rowClose all tags, ,

  • Table with 2 rows and 3 columns