<?xml version="1.0" encoding="UTF-8"?>
<clientlist>
<client>
<data key="id" value="111" />
<data key="name" value="The Parlotones" />
<data key="genre" value="Rock / Alternative" />
<data key="description" value="The Parlotones are known for their electric, polished stage performances delivered against the backdrop of their deftly crafted and darkly romantic lyrics." />
<data key="performanceday" value="Sunday" />
<data key="performancetime" value="01PM-03PM" />
<data key="picture" value="the-parlotones.jpg" />
</client>
<client>
<data key="id" value="222" />
<data key="name" value="ShortStraw" />
<data key="genre" value="Folk / Acoustic" />
<data key="description" value="Shortstraw are a joburg based band making waves on the national indie music scene in a big way." />
<data key="performanceday" value="Sunday" />
<data key="performancetime" value="03PM-05PM" />
<data key="picture" value="shortstraw.jpg" />
</client>
<client>
<data key="id" value="333" />
<data key="name" value="Gangs of Ballet" />
<data key="genre" value="Dance / Club" />
<data key="description" value="Their music, which combines their fresh energy with their musically intriguing melodies and arrangements, has a hauntingly anthemic sound." />
<data key="performanceday" value="Saturday" />
<data key="performancetime" value="11AM-01PM" />
<data key="picture" value="gangs-of-ballet.jpg" />
</client>
</clientlist>
I would like help converting 3PM/3AM times from my source file, into digital times, eg (15:00) in my output file using XSL and BASH, with the output being a XML document.
This is what I have so far in xsl :
<xsl:if test="not(PM)">
<starts>
<xsl:value-of select="number(substring before(data[@key='performancetime']/@value, '-'))" ></xsl:value-of>
</starts>
This results are NaN value appearing in all the "starts" and "ends" times.
I really need some help, Thank you :)
I would suggest you try it along the lines of:
Consider making a named template to do the conversion, then you can call it separate for the start and end time. I am making the assumption the input will only contain an hour element, and not minutes (i.e is of the form "hhAM" or "hhPM")
Then you can call it like this for the start time, for example
Try this XSLT