0

I would like to fix my xslt so that my

<StartDateTime>NaN-NaN-NaNTNaN:NaN:NaN-NaN:00</StartDateTime>

does not look like this. I would like to have the date and time instead.

My xml document

<Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:IXML="http://tsgweb.com" xmlns:CMCodeQueryHelper="urn:CMCodeQueryHelper" PackageID="ChargeDispSent" MessageID="670">
<Case InternalID="16170" ID="12" xmlns:user="http://tylertechnologies.com">
    <SentenceEvent ID="1606">
        <Sentence ID="776">
            <SentenceCharge>
                <ChargeID InternalChargeID="1616">1091</ChargeID>
            </SentenceCharge>
            <Additional>
                <HomeMonitoringComponent>
                    <Duration Op="E">
                        <StartDate>11/03/2015</StartDate>
                        <EndDate>12/02/2015</EndDate>
                        <StartTime Op="E">8:00 AM</StartTime>
                        <EndTime Op="E">9:00 AM</EndTime>
                    </Duration>
                </HomeMonitoringComponent>
            </Additional>
        </Sentence>
    </SentenceEvent>
</Case>

My xslt that formats and displays the date looks like this

<xsl:if test="string-length(Duration/StartDate) &gt; 0">
        <xsl:for-each select="Duration">
            <DispositionDurationalElement>
                <StartDateTime>
                    <xsl:value-of select="mscef:formatDateTime(string(concat(Duration/StartDate, ':', Duration/StartTime)))"/>
                </StartDateTime>
                <xsl:if test="string-length(Duration/EndDate)!=0">
                    <EndDateTime>
                        <xsl:value-of select="mscef:formatDateTime(string(concat(Duration/EndDate, ':', Duration/EndTime)))"/>
                    </EndDateTime>
                </xsl:if>
            </DispositionDurationalElement>
            </xsl:for-each>
        </xsl:if>

My output looks like this

<DispositionDurationalElement>
                <StartDateTime>NaN-NaN-NaNTNaN:NaN:NaN-NaN:00</StartDateTime>
            </DispositionDurationalElement>
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • **1.** Please post the expected result. **2.** What is the `mscef` prefix bound to? Which XSLT processor are you using? – michael.hor257k Nov 02 '15 at 21:44
  • The mscef is a function to formate the date (year month and date) and time (24 hour format). I would like to see date formated to year month and date and the time in 24 hour format like this `2015-11-03: 08:00` –  Nov 02 '15 at 21:53
  • Here is more information about XSLT processor and the mscf ` –  Nov 02 '15 at 21:56
  • This doesn't answer my questions. See here how to find out which processor you use: http://stackoverflow.com/questions/25244370/how-can-i-check-which-xslt-processor-is-being-used-in-solr/25245033#25245033 Also find the part in your stylesheet that says `xmlns:mscef="..."` and copy it here. XSLT has no formatDateTime() function - that's an extension and you need to read its documentation. Most likely it requires ISO 8601 formatted date-time as the input, so it won't help you here. Finally, post an example of a date in September or earlier, so we can see if the months are padded. – michael.hor257k Nov 02 '15 at 22:10
  • For the mscef I found this `xmlns:mscef="courts.state.WI.us/extfun" extension-element-prefixes="mscef msxsl" exclude-result-prefixes="msc"`. On the other hand, I wonder how can I just display unformated date and time instead? Like this `11/03/2015: 8:00 AM` –  Nov 02 '15 at 22:14

1 Answers1

0

On the other hand, I wonder how can I just display unformated date and time instead? Like this <StartDateTime>11/03/2015: 8:00 AM</StartDateTime>

That would be very easy - just use:

<StartDateTime>
    <xsl:value-of select="concat(StartDate, ': ', StartTime)"/>
</StartDateTime>
michael.hor257k
  • 113,275
  • 6
  • 33
  • 51