[英]Render App.config/Web.config files via XSLT
Does anyone have an XSLT that will take the app.config and render it into a non-techie palatable format?有没有人有一个 XSLT 可以接受 app.config 并将其呈现为非技术人员可口的格式?
The purpose being mainly informational, but with the nice side-effect of validating the XML (if it's been made invalid, it won't render)目的主要是提供信息,但具有验证 XML 的良好副作用(如果它无效,则不会呈现)
First draft at a solution to show解决方案的初稿显示
Whack this in the app.config:在 app.config 中敲这个:
<?xml-stylesheet type="text/xsl" href="display-config.xslt"?>
And this is the contents of 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>
What type of conversion are you looking for?您在寻找什么类型的转换? Just for informational purposes?只是为了提供信息? What level of detail are you looking to transform?您希望转换什么级别的细节?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.