| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.functions; |
| 9 | |
| 10 | import net.sf.saxon.expr.XPathContext; |
| 11 | import net.sf.saxon.om.Item; |
| 12 | import net.sf.saxon.om.ZeroOrOne; |
| 13 | import net.sf.saxon.value.StringValue; |
| 14 | |
| 15 | |
| 16 | /** |
| 17 | * This class implements the fn:lower-case() function |
| 18 | */ |
| 19 | |
| 20 | public class LowerCase extends ScalarSystemFunction { |
| 21 | |
| 22 | @Override |
| 23 | public StringValue evaluate(Item arg, XPathContext context) { |
| 24 | return StringValue.makeStringValue(arg.getStringValue().toLowerCase()); |
| 25 | } |
| 26 | |
| 27 | @Override |
| 28 | public ZeroOrOne<StringValue> resultWhenEmpty() { |
| 29 | return ZERO_LENGTH_STRING; |
| 30 | } |
| 31 | |
| 32 | public String getCompilerName() { |
| 33 | return "ForceCaseCompiler"; |
| 34 | } |
| 35 | |
| 36 | } |
| 37 |