M
morfius
Люди ну если ктонибудь тут есть живой помогите пожалуйста!!!!!
Первые две проблемы всё таки решил хотя и с огромным трудом.
Появилась новая:
после выполнения XSLT выдаёт нужную информацию а в конец файла дописывает данные из исходного XML в чистом виде: без тегов, но с переносами строк.
Исходный, файл и результат прилагаются в архиве. XSLT приведено здесь. XML-парсер - saxon 8. OS: Ubuntu 9.10
<!--shcode--><pre><code class='xml'><xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl
aram name='height' select ='/report/rephead/@height' />
<xsl
aram name='width' select ='/report/rephead/@width' />
<xsl:template match='/report/rephead'>
<xsl
aram name='lev' select='1'/>
<table border='1'>
<tr>
<td>
<xsl:attribute name='colspan'>
<xsl:value-of select='$width' />
</xsl:attribute>
<xsl:attribute name='rowspan'>
<xsl:value-of select='$height+1' />
</xsl:attribute>
</td>
</tr>
<xsl:call-template name='headTransform'>
<xsl:with-param name='lev' select='1'/>
</xsl:call-template>
<xsl:call-template name='bodyTransform' />
</table>
</xsl:template>
<xsl:template name='headTransform'>
<xsl
aram name='lev'/>
<tr align='center'>
<xsl:for-each select='/report/rephead/descendant::cell'>
<xsl:if test='@level = $lev'>
<td>
<xsl:attribute name='colspan'>
<xsl:value-of select='count(descendant::header)' />
</xsl:attribute>
<xsl:value-of select='@value' />
</td>
</xsl:if>
</xsl:for-each>
</tr>
<xsl:if test='$lev < $height'>
<xsl:call-template name='headTransform'>
<xsl:with-param name='lev' select='$lev+1'/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name='bodyTransform'>
<xsl:for-each select='/report/body/descendant::row'>
<tr>
<xsl:for-each select='descendant::cell'>
<td>
<xsl:value-of select="." />
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>[/CODE]
Первые две проблемы всё таки решил хотя и с огромным трудом.
Появилась новая:
после выполнения XSLT выдаёт нужную информацию а в конец файла дописывает данные из исходного XML в чистом виде: без тегов, но с переносами строк.
Исходный, файл и результат прилагаются в архиве. XSLT приведено здесь. XML-парсер - saxon 8. OS: Ubuntu 9.10
<!--shcode--><pre><code class='xml'><xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl
![Stick out tongue :p :p](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f61b.png)
<xsl
![Stick out tongue :p :p](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f61b.png)
<xsl:template match='/report/rephead'>
<xsl
![Stick out tongue :p :p](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f61b.png)
<table border='1'>
<tr>
<td>
<xsl:attribute name='colspan'>
<xsl:value-of select='$width' />
</xsl:attribute>
<xsl:attribute name='rowspan'>
<xsl:value-of select='$height+1' />
</xsl:attribute>
</td>
</tr>
<xsl:call-template name='headTransform'>
<xsl:with-param name='lev' select='1'/>
</xsl:call-template>
<xsl:call-template name='bodyTransform' />
</table>
</xsl:template>
<xsl:template name='headTransform'>
<xsl
![Stick out tongue :p :p](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f61b.png)
<tr align='center'>
<xsl:for-each select='/report/rephead/descendant::cell'>
<xsl:if test='@level = $lev'>
<td>
<xsl:attribute name='colspan'>
<xsl:value-of select='count(descendant::header)' />
</xsl:attribute>
<xsl:value-of select='@value' />
</td>
</xsl:if>
</xsl:for-each>
</tr>
<xsl:if test='$lev < $height'>
<xsl:call-template name='headTransform'>
<xsl:with-param name='lev' select='$lev+1'/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name='bodyTransform'>
<xsl:for-each select='/report/body/descendant::row'>
<tr>
<xsl:for-each select='descendant::cell'>
<td>
<xsl:value-of select="." />
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>[/CODE]