既存の XML データ フローから新しい XML を生成するのに最適な XSLT があります。ただし、ルート要素には、XSLT がデータの解析に失敗する原因となるいくつかの属性がリストされています。
属性を無視するには、XSLT にどのような変更を加える必要がありますか?
ルート要素は次のとおりです。
<CrystalReport xmlns="urn:crystal-reports:schemas:report-detail"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:crystal-reports:schemas:report-detail
http://www.businessobjects.com/products/xml/CR2008Schema.xsd">
単に属性を削除すると、XSLT は正常に動作します。それらが存在する場合、ファイル全体を無視します。
私の XSLT を見る必要がありますか?
ここに XSLT があります。(単に名前空間を無視するように XSLT を変更できますか?):
<?xml version="1.0"?><!-- DWXMLSource="STX050 Course Descriptions Parsed.xml" -->
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<xsl:key name="courses-by-title" match="Details" use="Section/DEPTSDESC1" />
<xsl:template match="CrystalReport">
<crystalreports>
<xsl:for-each select="Details[count(. | key('courses-by-title', Section/DEPTSDESC1)[1]) = 1]">
<xsl:sort select="Section/DEPTSDESC1" />
<department>
<Sectiontitle><xsl:value-of select="Section/DEPTSDESC1"/></Sectiontitle><xsl:text>
</xsl:text>
<xsl:for-each select="key('courses-by-title', Section/DEPTSDESC1)">
<xsl:sort select="Section/DEPTSDESC1" />
<Details>
<course><xsl:value-of select="Section/DEPTSDESC1"/></course><xsl:text> </xsl:text><courseno><xsl:value-of select="Section/CRSNO1"/></courseno><xsl:text>
</xsl:text><class><xsl:value-of select="Section/CRSTITLE1"/></class><xsl:text>
</xsl:text><classcredit><xsl:value-of select="Section/CRSMINCRED1"/></classcredit><xsl:text> credit hours
</xsl:text><description><xsl:value-of select="Section/CRSDESC1"/></description>
</Details><xsl:text>
</xsl:text>
</xsl:for-each>
</department>
</xsl:for-each>
</crystalreports>
</xsl:template>
</xsl:stylesheet>