"andrew_zak":
Привет!
есть ли возможность штатными средствами VS 9.0 (без дополнительных контролов других разработчиков) добиться подсветки синтаксиса xml на веб-страничке?
или может посоветуете какой нить фришный компонент?
подробнее о задаче - показать на веб-страничке xml-файл с подсветкой синтаксиса.
заранее спасибо.
Попробуйте применить к нему xslt преобразование.<?xml version="1.0" encoding="UTF-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <style type="text/css">.start-tag { color: maroon; font-weight: normal;}.end-tag { color: maroon; font-weight: normal; }.comment { color: green; font-style: italic;}.pi { color: orchid; font-style: italic;}.attribute-name { color: red; font-weight: normal;}.attribute-value { color: blue; font-weight: normal;} </style> <xsl:apply-templates /> </xsl:template> <xsl:template match="*"> <div class="tag" style="margin-left:2em;"> <xsl:text><</xsl:text> <strong class="start-tag"> <xsl:value-of select="name()" /> </strong> <xsl:text xml:space="preserve"> </xsl:text> <xsl:apply-templates select="@*" /> <xsl:if test="count(./*|./text()) < 1"> <xsl:text> /</xsl:text> </xsl:if> <xsl:text>></xsl:text> <xsl:apply-templates select="text()|*" /> <xsl:if test="count(./*|./text()) > 0"> <xsl:text></</xsl:text> <strong class="end-tag"> <xsl:value-of select="name()" /> </strong> <xsl:text>></xsl:text> </xsl:if> </div> </xsl:template> <xsl:template match="text()"> <xsl:copy-of select="." /> </xsl:template> <xsl:template match="@*"> <xsl:text xml:space="preserve"> </xsl:text> <span class="attribute-name"> <xsl:value-of select="name()" /> </span> <xsl:text>=</xsl:text> <xsl:text>"</xsl:text> <span class="attribute-value"> <xsl:value-of select="." /> </span> <xsl:text>"</xsl:text> </xsl:template></xsl:stylesheet>
Все должно быть просто, очень просто, настолько просто - насколько это возможно!