#### Previous topic

Case Study: AF1410 Steel

#### Next topic

Language Bindings

# Examples¶

Various topics have been considered or presented in considering this standard. Some are described below.

## Example XML Data Files¶

This section presents two examples of XML Data Files adhering to the cansas1d:1.1 standard.

The first file (data-simple.xml) is a basic example and the second file (cansas1d.xml) uses almost all the allowed elements. In each, though, most of the data has been removed to clarify the structure.

### data-simple.xml¶

The example data file data-simple.xml shows just the basic elements of the cansas1d:1.1 standard. Only a single data point has been shown to more clearly show the other structure. The data file is actually an excerpt from the bimodal-test1.xml (http://www.cansas.org/trac/browser/1dwg/trunk/bimodal-test1.xml) example file in the main distribution.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50  SAS bimodal test1 1992 0.0040157139 3497.473 90.72816 0.0045408653 3340.003 84.95314 bimodal-test1 simulated SAS calculation artificial 1.00 calculation create the SAS data 1992-01-31 spheres 100E20 0.1 1000.0 0.25 

The stylesheet (ascii3col.xsl) identified on line 2 of data-simple.xml is a very basic XSLT. When data-simple.xml is opened in a browser (from a directory containing both data-simple.xml and ascii3col.xsl), the result looked like this:

### cansas1d.xml¶

The example data file cansas1d.xml (http://www.cansas.org/trac/browser/1dwg/trunk/examples/cansas1d.xml) shows examples of most of the elements of the cansas1d:1.1 standard. Only a single data point has been provided here to more clearly show the other structure in the data file.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124  0.02 1000 3 0.01 SI600-new-long 1.03 0.327 0.0000 10.00 0.00 22.5 0.020
http://chemtools.chem.soton.ac.uk/projects/blog/blogs.php/bit_id/2720
canSAS instrument neutron 12.00 12.00 disc 6.00 0.22 1.00 14.3 50 11.000 0 fictional hybrid 4.150 0.00 0.00 0.00 322.64 327.68 5.00 5.00 spol 04-Sep-2007 18:35:02 10.000 180.0 0.0 USER:MASK.COM AvA1 0.0000E+00 AsA2 1.0000E+00 XvA3 1.0526E+03 XsA4 5.2200E-02 XfA5 0.0000E+00 S... 13597 0 2.26E+02 2A 5mM 0%D2O Sbak 13594 0 1.13E+02 H2O Buffer V... 13552 3 1.00E+00 H2O5m NCNR-IGOR 03-SEP-2006 11:42:47 Circular SEP06064.SA3_AJJ_L205 SEP06064.SA3_AJJ_L205 SEP06064.SA3_AJJ_L205 SEP06064.SA3_AJJ_L205 SEP06064.SA3_AJJ_L205 1 1 230.09 1


### Other Example Data Files¶

There are many example data files in the repository. They may be viewed with a WWW browser, [1] downloaded, or the entire directory may be checked out to create a local copy for you.

>>> svn co http://www.cansas.org/svn/1dwg/tags/v1.1/examples cansas1d-examples


## Example XML Stylesheets¶

This section presents examples of XML Stylesheets useful for the cansas1d:1.1 standard. XML Stylesheets (XSLT) are used to transform XML documents into other documents such as XML documents, xhtml documents, or even ASCII text. XML stylesheets also can be used to extract metadata from XML files.

### ascii3col.xsl¶

The ascii3col.xsl stylesheet displays all the Idata blocks in a cansas1d:1.1 file in 3-column ASCII form. Be careful using this stylesheet on files with multiple SASdata or SASentry blocks since this stylesheet assumes there is only one of each of these. While it is the most common case to have only one of each, some of the examples have multiple data sets. This stylesheet will concatenate all of the Idata.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 


### cansas1d.xsl¶

The cansas1d.xsl (at about 500 lines, it is too large to print here) is the standard XSL stylesheet for cansas1d:1.1 files. It shows all available SASdata and metadata, separated by the different SASentry blocks.