From 531d4e1a3c0749ffef7dc53684130b4fda5446fc Mon Sep 17 00:00:00 2001 From: Sean McCallum Date: Wed, 26 Jul 2017 16:34:31 -0600 Subject: [PATCH] Test and documentation for numeral-conversion.xsl changes to numeral-conversion.xsl: - comments for readability/future documentation - line 21 formatting for readability new test, numeral-conversion.xspec --- .../resources/xml/xslt/numeral-conversion.xsl | 12 +++- .../src/test/xspec/numeral-conversion.xspec | 55 +++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 common-utils/src/test/xspec/numeral-conversion.xspec diff --git a/common-utils/src/main/resources/xml/xslt/numeral-conversion.xsl b/common-utils/src/main/resources/xml/xslt/numeral-conversion.xsl index a40d680..a7705dc 100755 --- a/common-utils/src/main/resources/xml/xslt/numeral-conversion.xsl +++ b/common-utils/src/main/resources/xml/xslt/numeral-conversion.xsl @@ -5,17 +5,25 @@ + + + number(replace(replace(replace(replace(replace(replace(replace(upper-case(codepoints-to-string($char)),'I','1'),'V','5'),'X','10'),'L','50'),'C','100'),'D','500'),'M','1000'))"/> + + select="for $i in 1 to count($hindu-sequence) return + if (subsequence($hindu-sequence,$i+1) > $hindu-sequence[$i]) then + -$hindu-sequence[$i] + else + $hindu-sequence[$i]"/> + diff --git a/common-utils/src/test/xspec/numeral-conversion.xspec b/common-utils/src/test/xspec/numeral-conversion.xspec new file mode 100644 index 0000000..adf69a0 --- /dev/null +++ b/common-utils/src/test/xspec/numeral-conversion.xspec @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file