Q:

XSLT - Convert Date (YYYY-MM-DD) to Julian Day Number

Attempting to convert a standard date to Julian day number.  Is there a function or method that you have used to successfully convert a date?  This is for XSLT 2.0.  One additional constraint is no additional add-on packages can be used, just straight XSLT 2.0
Thank you in advance for your input. 
Example: 2016-07-05 Converts to 2457574.50000

A:

First, YYYY-MMM-DD is not a standard date.  You must convert the supplied string to a valid date in the YYYY-MM-DD format, before you can use any of the date functions.  Once you have done that, the calculation can be pretty straightforward.  
For convenience, the following stylesheet uses two custom-defined functions: one to convert the string a proper date, and one to calculate the actual Julian day number. 
XSLT 2.0
<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:my="http://www.example.com/my"
exclude-result-prefixes="xs my">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:function name="my:reformat-date">
    <xsl:param name="datestring"/>
    <xsl:variable name="y" select="substring($datestring, 1, 4)"/>
    <xsl:variable name="mmm" select="substring($datestring, 6, 3)"/>
    <xsl:variable name="d" select="substring($datestring, 10, 2)"/>
    <xsl:variable name="m" select="format-number(index-of(('JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'), $mmm), '00')"/>
    <xsl:sequence select="xs:date(concat($y, '-', $m, '-', $d))" />
</xsl:function>

<xsl:function name="my:julian-day-number">
    <xsl:param name="date" as="xs:date"/>
    <xsl:variable name="epoch" select="xs:date('-4714-11-24')"/>
    <xsl:sequence select="days-from-duration($date - $epoch)"/>
</xsl:function>

<xsl:template match="/">
    <result>
        <xsl:value-of select="my:julian-day-number(my:reformat-date('2016-JUL-05'))" />
    </result>
</xsl:template>

</xsl:stylesheet>

Result
<? xml version="1.0" encoding="UTF-8"? >
<result>2457575</result>

Note: 
Strictly speaking, a Julian day number changes at noon.  If your input does not indicate the time of the day, the decision whether to select the number for the AM or the PM part of the given date is purely arbitrary.