I'm new to XSL and v1.0 is what I am using to display content on a very stripped down version of Share Point (no SP Designer or anything that would make my task more achievable). I do not have the option of upgrading to XSL 2.0 and cannot import any XSL extensions, so hopefully someone can help me figure out how to work with this. Also, this may sound really stupid, but I have no idea what processor I'm using...I will assume that it's probably whatever is by MicroSoft, as I know there is a
vb file that my boss wrote to parse the XML data to the XSL (I think I'm saying that right).
I have an XML list of several elements queried from a database. The table in my code will display most of these elements, others are used to sort, but are of no importance to the viewer of the final table displayed.
Sample of XML:
<Data>
<BlastLogs>
<item DateRangeByMonth="2010_2" ID="55" Date="2/3/2010 12:00:00 AM" Version="N/A" BlastType="ABORT" Error="compile failure" Code="" Developer="" Team=""
Action="ABORT" Impact="N"/>
<item DateRangeByMonth="2010_2" ID="54" Date="2/2/2010 12:00:00 AM" Version="9.44" BlastType="FULL" Error="" Code="" Developer="" Team="" Action="" Impact=""/>
<item DateRangeByMonth="2010_2" ID="52" Date="2/1/2010 12:00:00 AM" Version="9.43" BlastType="FULL" Error="issue with deployment2" Code="" Developer="" Team=""
Action="HOTFIX" Impact=""/>
<item DateRangeByMonth="2010_2" ID="53" Date="2/1/2010 12:00:00 AM" Version="9.43.1" BlastType="HOTFIX" Error="" Code="Tagger.
vb" Developer="developer1"
Team="team8" Action="" Impact="Y"/>
.
.
.
<item DateRangeByMonth="2010_1" ID="90" Date="1/7/2010 12:00:00 AM" Version="9.26" BlastType="FULL" Error="" Code="" Developer="" Team="" Action="" Impact=""/>
<item DateRangeByMonth="2010_1" ID="91" Date="1/6/2010 12:00:00 AM" Version="9.25" BlastType="FULL" Error="" Code="" Developer="" Team="" Action="" Impact=""/>
<item DateRangeByMonth="2010_1" ID="92" Date="1/5/2010 12:00:00 AM" Version="9.24" BlastType="FULL" Error="" Code="" Developer="" Team="" Action="" Impact=""/>
<item DateRangeByMonth="2010_1" ID="93" Date="1/4/2010 12:00:00 AM" Version="9.23" BlastType="HOTFIX" Error="issue with deployment1" Code=""
Developer="developer2" Team="team9" Action="" Impact="Y"/>
<item DateRangeByMonth="2010_1" ID="94" Date="1/4/2010 12:00:00 AM" Version="9.23" BlastType="FULL" Error="" Code="" Developer="" Team="" Action="" Impact=""/>
Each line in the table displays Date/Version/BlastType/Error/Code/Developer/Team and I can successfully populate the table to display ALL entries as well as I can successfully show only data for 1 month that meets the hard coded date:
<xsl:for-each select="@DateRangeByMonth"/>
<xsl:if test="@DateRangeByMonth='2010_1'">
<!-- table rows defining how to display the data -->
</xsl:if>
Another thought process had me going down the path of separating out year and month, since there will be multiple:
<!-- variable to truncate -->
<xsl:variable name="myDateRange">
<xsl:for-each select="@DateRangeByMonth"/>
<xsl:value-of select="@DateRangeByMonth"/>
</xsl:variable>
<!-- variable to truncate datepart to just year -->
<xsl:variable name="myYear">
<xsl:for-each select="@DateRangeByMonth"/>
<xsl:value-of select="substring-before($myDateRange,'_')"/>
</xsl:variable>
<!-- variable to truncate datepart to just month -->
<xsl:variable name="myMonth">
<xsl:for-each select="@DateRangeByMonth"/>
<xsl:value-of select="substring-after($myDateRange,'_')"/>
</xsl:variable>
<!-- Selects date range -->
<xsl:for-each select="@DateRangeByMonth"/>
<xsl:if test="$myYear='2010'">
<xsl:if test="$myMonth='1'">
<!-- table rows defining how to display the data -->
</xsl:if>
</xsl:if>
I'm trying to get the hang of templates (apply-templates, call-template, ...) and how to use them. What I'd like to do (if this is even how templates work), is have my if = month1 or january or 2010_1 (at this point, i don't necessarily care what format), if = month2 or february or 2010_2, .... then match=item (i think) and call or apply a template to display the table with the data of monthX.
So, here's the second part of what i'm trying to do....which I'm coming to think is going to be the more difficult part. The original idea was to display a simple table of the months (row1 - jan/feb/mar, row2 - apr/may/jun, row3 - jul/aug/sep, row4 - oct/nov/dec) for each year and based on the link or choosing that month, that would be the parameter determining the data to display. Right now I have this as a separate xsl document, but i'm not exactly sure how that's how it will end up working.
Sample of simple Month table (partial):
<tr>
<td valign="middle" align="center" style="width: 25%">
<th><a href="#">January</a></th></td>
<td valign="middle" align="center" style="width: 25%">
<th><a href="#">February</a></th></td>
<td valign="middle" align="center" style="width: 25%">
<th><a href="#">March</a></th></td>
</tr>
.
.
.
If I keep it as two xsl docs working together, what do i include for the href? It doesn't like anything looking like "http://.../blablah.aspx?ReportType=BlastLogs&XSL=http://..." even if I use encoding for the not liked characters. Do I not href anything and do everything in one XSL making each month a parameter and tell it if i click on it that it displays only monthX data? So this is where I'm stuck figuring out what parameters and templates to create and how to use them correctly.
Can anyone offer any advice with what information I've provided? If necessary I can clarify further or provide more code. I'm open to any help I can get.
Thanks, in advance!