2017-01-01 7 views
0

xslとxmlファイルを作成するアプリケーションを作成しましたが、出力が(予想されるHTMLテーブルのように)XMLレイアウトとして表示されません。出力がInternet ExplorerでXMLテーブルとして表示されない

出力をHTML表のように見せるには、xmlまたはxslファイルのいずれかの変更を行う必要がありますか?

さまざまなブラウザを確認しましたが、いずれも下の出力(エッジ)または出力がありません。

xmlファイル(newfile_output.xml)は、コンテンツを持っています

<?xml version="1.0" encoding="utf-8"?> 
<?xml-stylesheet type="text/xsl"  
    href="C:\Users\Michel\Documents\newfile_output.xsl"?> 
<patch_list xml:lang="en"> 
    <patch> 
    <type>Program</type> 
    <id>I-B000</id> 
    <name>Jazz Dry/Amb1 Kit SL1,2</name> 
    <favorite> </favorite> 
    <category>Drums</category> 
    <subcategory>Natural Drums</subcategory> 
    <setlistname></setlistname> 
    <setlistslotreferenceid></setlistslotreferenceid> 
    <setlistslotreferencename></setlistslotreferencename> 
    <description></description> 
    </patch> 
    .... 
    <patch> 
    <type>WaveSequence</type> 
    <id>U-F012</id> 
    <name>Looped Cello G Vibrato</name> 
    <favorite> </favorite> 
    <category></category> 
    <subcategory></subcategory> 
    <setlistname></setlistname> 
    <setlistslotreferenceid></setlistslotreferenceid> 
    <setlistslotreferencename></setlistslotreferencename> 
    <description></description> 
    </patch> 
</patch_list> 

XSLファイル(newfile_output.xsl)は、次の内容を持っています

<?xml version="1.0"?> 
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:template match="/"> 
    <html> 
    <body> 
    <h2>Patch List</h2> 
    <table border="1"> 
     <tr bgcolor="#80a0ff"> 
     <th>ListSubType</th> 
     <th>Id</th> 
     <th>Name</th> 
     <th>Fav</th> 
     <th>Category</th> 
     <th>Sub Category</th> 
     <th>Set List Slot Reference Id</th> 
     <th>Set List Slot Reference Name</th> 
     <th>Set List Name</th> 
     <th>Description</th> 
     </tr> 
     <xsl:for-each select="patch_list/patch"> 
     <tr> 
      <td><xsl:value-of select="type"/></td> 
      <td><xsl:value-of select="id"/></td> 
      <td><xsl:value-of select="name"/></td> 
      <td><xsl:value-of select="favorite"/></td> 
      <td><xsl:value-of select="category"/></td> 
      <td><xsl:value-of select="subcategory"/></td> 
      <td><xsl:value-of select="setlistslotreferenceid"/></td> 
      <td><xsl:value-of select="setlistslotreferencename"/></td> 
      <td><xsl:value-of select="setlistname"/></td> 
      <td><xsl:value-of select="description"/></td> 
     </tr> 
     </xsl:for-each> 
    </table> 
    </body> 
    </html> 
</xsl:template> 
</xsl:stylesheet> 

出力は次のようになります。

Program I-A000 KRONOS German Grand Keyboard A.Piano Program I-A001 German 
Dark Grand Keyboard A.Piano Program I-A002 R.Ferrante German Grand Keyboard 
A.Piano Program I-A003 German New Age Grand Keyboard A.Piano Program I-A004 
L.Mays German Grand Keyboard A.Piano Program I-A005 German Grand + VPM 
Keyboard A.Piano Program I-A006 KRONOS Japanese Grand Keyboard A.Piano 
Program I-A007 Japanese ... 
+2

href = "C:\ Users \ Michel \ Documents \ newfile_output.xsl"は適切なURLではありません。適切なURLを作成します。 – Tomalak

答えて

1

私はそれが正常に動作している私のIEブラウザで試してみました。 参照するXSLファイルのファイルアクセス権とディレクトリパスを確認してください。

+0

実際の問題は、私が表示していない部分の中の不正なHTML文字であることがわかったので、私はこの答えを受け入れました。ヘッダー/フッターまたはXSLファイルの一部と思っていました。 –

1

追加

あなたの

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 

要素の後

。それはのようになります

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:output method="html" indent="yes" /> 
    <xsl:template match="/"> 
    ... 
関連する問題