M
mslyman
Hi,
I could do with some help. I have this XML.
<region>
<region_code>567</region_code>
<store>
<store_code>345</store_code>
<dept>
<dept_code>32</dept_code>
</dept>
<dept>
<dept_code>33</dept_code>
</dept>
</store>
<store>
<store_code>7</store_code>
<dept>
<dept_code>9</dept_code>
</dept>
<dept>
<dept_code>8</dept_code>
</dept>
</store>
<store>
<!--- more depts -->
</store>
</region>
<region>
<region_code>776</region_code>
<!--- more stores -->
</region>
I need this output to html as follows:
<table>
<tr>
<td title="region">567</td>
<td title="store">345</td>
<td title="dept">34</td>
</tr>
<tr>
<td></td>
<td></td>
<td title="dept">33</td>
</tr>
<tr>
<td></td>
<td title="store">7</td>
<td title="dept">8</td>
</tr>
<tr>
<td></td>
<td></td>
<td title="dept">9</td>
</tr>
<tr>
<td title="region">776</td>
<!-- etc -->
</tr>
<!-- etc -->
</table>
I have tried to achieve this with my limited amount of xsl knowledge of
<xsl:for-each >, nested <xsl:for-each > and <xsl:if
test="position()=1"> and i get close ( by using <xsl:for-each
select="dept"> ) but it's not right. I guessing I have to
apply-templates/recursion but not sure how.
Please if anyone could help that would be great.
Thanks,
Mark
I could do with some help. I have this XML.
<region>
<region_code>567</region_code>
<store>
<store_code>345</store_code>
<dept>
<dept_code>32</dept_code>
</dept>
<dept>
<dept_code>33</dept_code>
</dept>
</store>
<store>
<store_code>7</store_code>
<dept>
<dept_code>9</dept_code>
</dept>
<dept>
<dept_code>8</dept_code>
</dept>
</store>
<store>
<!--- more depts -->
</store>
</region>
<region>
<region_code>776</region_code>
<!--- more stores -->
</region>
I need this output to html as follows:
<table>
<tr>
<td title="region">567</td>
<td title="store">345</td>
<td title="dept">34</td>
</tr>
<tr>
<td></td>
<td></td>
<td title="dept">33</td>
</tr>
<tr>
<td></td>
<td title="store">7</td>
<td title="dept">8</td>
</tr>
<tr>
<td></td>
<td></td>
<td title="dept">9</td>
</tr>
<tr>
<td title="region">776</td>
<!-- etc -->
</tr>
<!-- etc -->
</table>
I have tried to achieve this with my limited amount of xsl knowledge of
<xsl:for-each >, nested <xsl:for-each > and <xsl:if
test="position()=1"> and i get close ( by using <xsl:for-each
select="dept"> ) but it's not right. I guessing I have to
apply-templates/recursion but not sure how.
Please if anyone could help that would be great.
Thanks,
Mark