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

  • Published on
    13-Jan-2016

  • View
    219

  • Download
    7

Transcript

<ul><li><p>ACG 4401XSLTExtensible Stylesheet Language for TransformationsPresenting XML and XBRL</p></li><li><p>XSLTExtensibleHey its based on XMLStylesheetWhat the data will look likeLanguageScriptingTransformationsReuse, Repurpose, calculate, sort, etc.</p></li><li><p>XSLT PartsXSLTransform Instance Document to different FormHTML, XHTML, XML (new), PDFXSLFOFor formatting data</p></li><li><p>Re-PurposeThe main benefit of XML / XBRLReusability of Data contained in Instance DocumentWe need a method of presenting the dataPresentation LinkbaseXSLT</p></li><li><p>A UBL Catalogue Node TreeCatalogueIDNameIssueDate+ProviderParty+ReceiverParty+CatalogueLineLeaf NodesBranch NodesPartyPartyNameName</p></li><li><p>Transformation Requires xml code in Two DocumentsInstance Document2nd Prolog line linking instance document to XSLT documentXSLT DocumentContains script for selecting elements to be displayed</p></li><li><p>XSLT2 Inputs:Instance &amp; XSLTProcessingBrowserXML ProcessorXMLInstancedocumentXSLTInstructionsXMLResultdocumentMust have 2nd prolog linking to .xsl</p></li><li><p>Transforming your Instance DocumentContain elements and data but..Do NOT contain formatting informationAdd an additional prolog statementConnects your .xml to your .xsl document</p><p>xml-stylesheetTells the processor to use the stylesheet file to transform the data in the .xml documenthref=Points to location of .xsl document.</p></li><li><p>XSLT (the XML code)Root Elementnamespace declaration</p><p>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!</p></li><li><p>XSLT Scripting CodeElements used:templatesfor-eachvalue-ofFunctionsFormattingFormat-numberSumMathematical Operations+, -, *, div</p></li><li><p>TemplatesLine that follows root elementWhat elements from .xml are being used?Templates provide answerProcessing Elements from Instance against Template created in XSLT</p><p>/ = Look in entire source document</p></li><li><p>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</p></li><li><p> Basketball12345 12.5025.00 </p></li><li><p>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.</p><p>Value-of select can use a function.....</p></li><li><p>FunctionsNumericceiling()floor()number()round()sum()Stringconcat()contains()normalize-space()starts-with()string()string-length()substring()substring-after()substring-before()translate()</p></li><li><p>format() functionformat-number attribute has two argumentsNumberPattern (see formatting patterns)</p><p>Numberpattern</p></li><li><p>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. </p></li><li><p>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.</p></li><li><p>Accessing Remote Instance Docsdocument() function</p></li><li><p>Output (HTML)</p><p>Transformation will be to an HTML doc.</p><p>All tags must be closed!</p></li><li><p>Defining Tables in HTML</p><p>Tells browser to begin making a tabl</p><p>Tells browser to insert a new row</p><p>Tells browser to use text as heading (1st row)</p><p>Tells browser to insert a new column in the new rowClose all tags, , </p></li><li><p>Table with 2 rows and 3 columns</p><p>r1c1r1c2r1c3</p><p>r2c1r2c2r2c3</p><p>**</p></li></ul>

Recommended

View more >