У меня есть документ xml в следующем формате, и я хочу преобразовать его с помощью шаблона xsl.
Я новичок в преобразованиях xsl, и мне нужно только знать, как рекурсивно проходить по дереву, но решение всей проблемы было бы неплохо.
Это xml-документ:
<?xml version="1.0" encoding="UTF-8" ?>
<nodes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node>
<type>Parent</type>
<name>.test</name>
<node>
<type>parent</type>
<name>.test.root</name>
<node>
<type>Parent</type>
<name>.test.root.group</name>
<node>
<type>int</type>
<name>.test.root.group.a</name>
<value>0</value>
</node>
<node>
<type>char</type>
<name>.test.root.group.b</name>
<value>-</value>
</node>
</node>
</node>
<node>
<type>parent</type>
<name>.test.versions</name>
<node>
<type>utf-8</type>
<name>.test.versions.version</name>
<value>alpha</value>
</node>
<node>
<type>utf-8</type>
<name>.test.version.extra</name>
<value>16.5</value>
</node>
</node>
</node>
</nodes>
И вот как я хотел бы, чтобы созданный html выглядел так:
.---------------------------------------------. | tree | value | type | |------------------------+-----------+--------| | '- test | | parent | | |- root | | parent | | | '- group | | parent | | | |- a | 0 | int | | | '- b | - | char | | '- versions | | parent | | |- version | "alpha" | utf-8 | | '- extra | 16.5 | utf-8 | '---------------------------------------------'