OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

unitsml message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Asynch: Conversions via XSL


I'm still trying to make this an XSLT 1.0 stylesheet by the
way, although I'm still failing. The comment at the top of the
stylesheet itself is a bit outdated... I've solved the problems
the existing browsers will stumble over, but found another one...
well, at least it's working as a 2.0 stylesheet.

Alright: I've attached an examples.zip which contains:
convertToTargetUnitSystem.xsl  -- the "program"
NVUnitsMLSchema.xsd            -- schema for NVUnitsML
UnitsML.xsd                    -- 9.18 UnitsML schema
UnitsML-USCD.xsd               -- schema for USCDL
time-nv.xml                    -- play data
Example{1,2}.xml               -- 2 examples: output
USCD-Example{1,2}.xml          -- 2 examples: USCDL input.
transform.sh                   -- shell script I used to run saxon

You will need an XSLT 2.0 processor (not necessarily schema aware),
i.e. Saxon9 (home edition and up), the Altova Runtime, I've also heard
rumors there might exist other working 2.0 implementations. Feel free
to use it on them.

I have used saxon 9 home edition successfully, basically calling:

java net.sf.saxon.Transform -s:convertToTargetUnitSystem.xsl\
	-o:<out> -s:time-nv.xml USCDFile=<USCD>

the example uses seconds, minutes, hours, days etc. to convert
to different scales (either by trying to fit the numerical value
into some boundary, see example 2, or by dumbly converting everything
to seconds, see example 1).

The USCDL (Unit System Conversion Description Language, don't you
like acronyms?) is, together with the stylesheet capable of even more
computations, like try and maximize or minimize values, convert multiple
units at once (which is why it's called convertToTargetUnitSYSTEM,
e.g. converting from metric to US or back), prefer/avoid units etc.
The stylesheet as well as thorough documentation will be added to the
Unitsml.nist.gov site RSN.

The "program" (if you look at it) seems complicated, but you will realize
most of the complicated stuff is the more sophisticated features. The
conversion itself is pretty straight forward. This can also serve to generate
less flexible stylesheets. Please also regard it as a WIP although I'm
looking forward to receiving comments about it.

-Martin

examples.zip



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]