-1
我很沒經驗,所以我想要一些幫助。複製一切,除非值相同
我在XML導出的數據庫的Filemaker,這是結果
<?xml version="1.0" encoding="UTF-8"?>
<!-- Questa grammatica non è più in uso - usare FMPXMLRESULT al suo posto -->
<FMPDSORESULT>
<ROW MODID="5" RECORDID="2">
<FASCICOLO>Adams John</FASCICOLO>
<TITOLO_DOC>John Adams to Mr X</TITOLO_DOC>
<LUOGO>New York</LUOGO>
<GG>27</GG>
<MM>04</MM>
<AA>1969</AA>
<CONTENUTO>Greetings</CONTENUTO>
<TIPOLOGIA>letter</TIPOLOGIA>
<NUM_CARTE>1</NUM_CARTE>
<INTEGR_DESC/>
</ROW>
<ROW MODID="6" RECORDID="6">
<FASCICOLO>Adams John</FASCICOLO>
<TITOLO_DOC>John Adams to Mr X</TITOLO_DOC>
<LUOGO>s.l.</LUOGO>
<GG>03</GG>
<MM>07</MM>
<AA>1996</AA>
<CONTENUTO>Greetings</CONTENUTO>
<TIPOLOGIA>letter</TIPOLOGIA>
<NUM_CARTE>3</NUM_CARTE>
<INTEGR_DESC>Presente la busta originale.</INTEGR_DESC>
</ROW>
等(我還沒有把它抄了所有)
我用這個XSL文件轉換它
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" encoding="iso-8859-1"/>
<xsl:template match="/">
<xsl:element name="dsc">
<xsl:for-each select="//ROW">
<xsl:element name="c">
<xsl:attribute name="level">file</xsl:attribute>
<xsl:attribute name="id">.</xsl:attribute>
<xsl:element name="did">
<xsl:element name="unittitle">
<xsl:attribute name="encodinganalog">ISAD 1 - 2 title</xsl:attribute>
<xsl:value-of select="./FASCICOLO/text()"/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
,我得到這個XML文件
<?xml version="1.0" encoding="ISO-8859-1"?>
<dsc>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Adams John</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Adams John</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Doe Jane</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Doe Jane</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Doe Jane</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Doe Jane</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Green Charles</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Green Charles</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Green Charles</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Jones Charles</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">White Walter</unittitle>
</did>
</c>
我需要得到相同,但與姓名重複一次,這樣說:
<?xml version="1.0" encoding="ISO-8859-1"?>
<dsc>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Adams John</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Doe Jane</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Green Charles</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">Jones Charles</unittitle>
</did>
</c>
<c level="file" id=".">
<did>
<unittitle encodinganalog="ISAD 1 - 2 title">White Walter</unittitle>
</did>
</c>
這是一個例子,真正的文件會更可能有很多重複的更大,所以我不想手動刪除它們。可能嗎?非常感謝
你的問題非常模糊,你沒有提到你打算如何做到這一點。你會使用.NET,PHP,Python等嗎? – EStafford
對不起 我打算使用XSL,但正如你所看到的,我對這些事情知之甚少 – user3276589
到目前爲止,您是否嘗試過任何XSLT?如果是這樣,請讓我們知道你的出發點。 –