I am currently trying to access the data from multiple XML files. I've easily accessed data from the first known as Rainfall.xml but have been unable to retrieve any data from the next file in my list Max_temp.xml.
The overall objective is to combine 4-5 XML files together to include all of the data about various weather events and also the station which these events were recorded at.
The example code is below:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<!-- TODO customize transformation rules
syntax recommendation http://www.w3.org/TR/xslt
-->
<xsl:variable name="maxTemp" select="document('Max_temp.xml')" />
<xsl:template match="rainfall">
<weather>
<xsl:apply-templates select="measurement" />
</weather>
</xsl:template>
<xsl:template match="measurement">
<measurement>
<StationNum><xsl:value-of select="StationNum"/></StationNum>
<Date><xsl:value-of select="concat(Day,'/',Month,'/',Year)"/></Date>
<xsl:variable name="Date" select="concat(Day,'/',Month'/',Year)"/>
<Rainfall><xsl:value-of select="Volume"/></Rainfall>
<MaxTemp><xsl:value-of select="$MaxTemp/maxTemp/measurement[concat(Day,'/',Month'/',Year)].equals(Date)"/></MaxTemp>
</measurement>
</xsl:template>
</xsl:stylesheet>
The structure of the XML files being used is as follows:
<typeOfFile(Rainfall, Temp, Solar Radiation etc)>
<measurment>
<Code>...</Code>
<Station>...</Station>
<Day>...</Day>
<Month>...</Month>
<Year>...</Year>
<Volume>...</Volume>
</measurement>
</typeOfFile>
I am currently getting a non-response from the browser when trying to load the corresponding Rainfall.xml file which this XSL sheet styles.
Can someone please point me in the right direction? Also if anyone can refer me to some information about using an XSL sheet to create and format an XML file it'd be much appreciated.