Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "ACG 4401 XSLT Extensible Stylesheet Language for Transformations Presenting XML and XBRL."— Presentation transcript:

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

2 Re-Purpose  The main benefit of XML / XBRL Reusability of Data contained in Instance Document We need a method of presenting the data  Presentation Linkbase  XSLT

3 XSLT  Extensible Hey it’s based on XML  Stylesheet What the data will look like  Language Scripting  Transformations Reuse, Repurpose, calculate, sort, etc.

4 XSLT Parts  XSL Transform Instance Document to different Form  HTML, XHTML, XML (new), PDF  XSLFO For formatting data

5 XSLT 2 Inputs: 2 Inputs: Instance & XSLT Instance & XSLT Processing Processing Browser Browser XML Processor XML Instance document XSLT Instructions XML Result document

6

7 A UBL Catalogue Node Tree Catalogue IDName Issue Date + Provider Party + Receiver Party + Catalogue Line Leaf Nodes Branch Nodes Party PartyName Name

8 Transformation Requires xml code in Two Documents  Instance Document 2 nd Prolog line linking to xslt document  XSLT Document Contains script for selecting elements to be displayed

9 Transforming your Instance Document  Add an additional prolog statement  Connects your.xml to your.xsl document xml-stylesheet  Tells the processor to use the stylesheet file to transform the data in the.xml document href=  Points to location of.xsl document.

10 XSLT (the XML code)  Root Element namespace declaration http://www.w3.org/1999/XSL/Transform All other namespaces used in the instance document (MUST MATCH)  Default namespaces (e.g. without the prefix) are not allowed in XSLT v 1.0 Need to make up a prefix

11 XSLT Scripting Code  Elements used: templates for-each value-of Functions  Formatting  Format-number  Sum  Mathematical Operations +, -, *, div

12 Templates  Line that follows root element  What elements from.xml are being used?  Templates provide answer  Processing Elements from Instance against Template created in XSLT  / = Look in entire source document

13 How to transform data  container Tells processor transformation will use html tags.  Remaining code between and code is the data to be transformed and the formatting code for the transformation

14 Basketball 12345 12.50 25.00

15 value-of  Selects and transforms/formats  Displays the value of the selected element At the end of the node Based on select attribute  You must point to the “node” you want displayed  “Full node path” “Inventory/InventoryItem/IdNumber” = 12345  “//elementname” Used when one and only one element has the name Start at root and look for element name.   Value-of select can use a function.....

16 for-each loop  Selects All elements contained in a node-set  Node-set is declared with select attribute  Additional.xsl code provide instructions for what to do with selected data What transformations to make HTML, and XSL tags combined. 

17 Functions Numeric  ceiling()  floor()  number()  round()  sum() String  concat()  contains()  normalize-space()  starts-with()  string()  string-length()  substring()  substring-after()  substring-before()  translate()

18 format() function  format-number attribute has two arguments Number Pattern (see formatting patterns)  Number pattern

19 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.

20 Accessing Remote Instance Docs  document() function 

21 Output (HTML)  Transformation will be to an HTML doc.   All tags must be closed!

22 Defining Tables in HTML  Tells browser to begin making a table  Tells browser to use text as heading (1 st row)  Tells browser to insert a new row  Tells browser to insert a new column in the new row  Close all tags,,

23 Table with 2 rows and 3 columns r1c1 r1c2 r1c3 r2c1 r2c2 r2c3


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

Similar presentations


Ads by Google