c# - Work backwards from an xslt to create an xml -
so, have quite few xslt files need generate preview for, not have corresponding xml files. wondering if possible go through xslt file , create list of required fields xslt? example,
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title" /></td> <td><xsl:value-of select="artist" /></td> </tr> </xsl:for-each> </xsl:template> </xsl:stylesheet>
i want go xslt this: "/catalog/cd/title, /catalog/cd/artist" fields required xslt, or set default value of them outputs "/catalog/cd/title" title , "/catalog/cd/artist" artist.
just give shot, won't work multiple templates:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0" exclude-result-prefixes="xsl"> <xsl:output method="xml" indent="yes"/> <xsl:variable name="xsl-namespace">http://www.w3.org/1999/xsl/transform</xsl:variable> <xsl:template match="*[namespace-uri() != $xsl-namespace]" > <xsl:copy> <xsl:apply-templates select="@*[namespace-uri() != $xsl-namespace]"/> <xsl:apply-templates select="*[namespace-uri() != $xsl-namespace]"/> </xsl:copy> </xsl:template> <xsl:template match="@*[namespace-uri() != $xsl-namespace]" > <xsl:copy/> </xsl:template>
Comments
Post a Comment