N
ned786
I have a list of files like this in a file called docs.xml:
<docroot>
<root href="file:///C:/doc_source/aaa.xml" />
<root href="file:///C:/doc_source/bbb.xml" />
<root href="file:///C:/doc_source/ccc.xml" />
</docroot>
I pass in docs.xml and parse it like this, outputting an xml file:
<xsl:template match="/">
<root>
<class>
<xsl:apply-templates select="document(docroot/root/@href, .)/
root/class/property">
<xsl:sort select="@name" lang="en"/>
</xsl:apply-templates>
</class>
</root>
</xsl:template>
<xsl:template match="property">
<xsl:copy-of select="."/>
</xsl:template>
There are a lot of repeated items in these external files and I get a
result doc like this:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<class>
<property name="Active"/>
<property name="Active"/>
<property name="Active"/>
<property name="Inactive"/>
<property name="Inactive"/>
<property name="Inactive"/>
<property name="Synchronous"/>
<property name="Synchronous"/>
<property name="Synchronous"/>
</class>
</root>
There might be 2 Active <property>s from aaa.xml, then the next comes
from bbb.xml etc. How can I get just one of each (one <property
name="Active">, one <property name="Inactive">, etc) in my output
doc?
I'm using Saxon 8.7.1J.
Thanks,
Mark
<docroot>
<root href="file:///C:/doc_source/aaa.xml" />
<root href="file:///C:/doc_source/bbb.xml" />
<root href="file:///C:/doc_source/ccc.xml" />
</docroot>
I pass in docs.xml and parse it like this, outputting an xml file:
<xsl:template match="/">
<root>
<class>
<xsl:apply-templates select="document(docroot/root/@href, .)/
root/class/property">
<xsl:sort select="@name" lang="en"/>
</xsl:apply-templates>
</class>
</root>
</xsl:template>
<xsl:template match="property">
<xsl:copy-of select="."/>
</xsl:template>
There are a lot of repeated items in these external files and I get a
result doc like this:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<class>
<property name="Active"/>
<property name="Active"/>
<property name="Active"/>
<property name="Inactive"/>
<property name="Inactive"/>
<property name="Inactive"/>
<property name="Synchronous"/>
<property name="Synchronous"/>
<property name="Synchronous"/>
</class>
</root>
There might be 2 Active <property>s from aaa.xml, then the next comes
from bbb.xml etc. How can I get just one of each (one <property
name="Active">, one <property name="Inactive">, etc) in my output
doc?
I'm using Saxon 8.7.1J.
Thanks,
Mark