1

app.config を取り、それを非技術者の口当たりの良い形式にレンダリングする XSLT を持っている人はいますか?

目的は主に情報提供ですが、XML を検証するという素晴らしい副次的な効果もあります (無効にするとレンダリングされません)。

4

2 に答える 2

2

表示するソリューションの最初のドラフト

  • 接続文字列
  • アプリの設定

これをapp.configで叩いてください:

<?xml-stylesheet type="text/xsl" href="display-config.xslt"?>

これは、display-config.xslt の内容です。

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
   <html>
    <body>
     <h2>Settings</h2> 
     <xsl:apply-templates /> 
    </body>
   </html>
  </xsl:template>      


  <xsl:template match="connectionStrings">
   <h3>Connection Strings</h3>
   <table border="1">
    <tr bgcolor="#abcdef">
     <th align="left">Name</th>
     <th align="left">Connection String</th>
    </tr>
    <xsl:for-each select="add">
     <tr>
      <td><xsl:value-of select="@name"/></td>
      <td><xsl:value-of select="@connectionString"/></td>
     </tr>
    </xsl:for-each>
   </table>
  </xsl:template>


  <xsl:template match="appSettings">
   <h3>Settings</h3>
   <table border="1">
    <tr bgcolor="#abcdef">
     <th align="left">Key</th>
     <th align="left">Value</th>
    </tr>
    <xsl:for-each select="add">
     <tr>
      <td><xsl:value-of select="@key"/></td>
      <td><xsl:value-of select="@value"/></td>
     </tr>
    </xsl:for-each>
   </table>
  </xsl:template>
</xsl:stylesheet>
于 2008-10-15T01:59:19.223 に答える
0

どのタイプの変換をお探しですか? 情報提供のみを目的としていますか?どのレベルの詳細を変換しようとしていますか?

于 2008-10-08T14:30:21.313 に答える