|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Newbie Question: Creating Error Description from
It seems like you mainly want to copy stuff
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
But change request to response
<xsl:template match="request">
<response>
<xsl:apply-templates/>
</response>
</xsl:template>
zap all elements that mach some "error predicate" (no child node in
this case)
<xsl:template match="header/*[not(node()]"/>
If there are any error elements, add an errordescription
<xsl:template match="header">
<header>
<xsl:apply-templates/>
<xsl:variable name="bad" select="*[not(node()]"/>
<xsl:if test="$bad">
<errorDescription>
<xsl:text>Invalid Elements:</xsl:text>
<xsl:for-each select="$bad">
<xsl:value-of select="name()"/>
<xsl:if test="position()!=last()">,</xsl:if>
</xsl:for-each>
<errorDescription>
</xsl:if>
</header>
</xsl:template>
David
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








