Re: [xsl] stop the processing of default attributes?

Subject: Re: [xsl] stop the processing of default attributes?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 19 Aug 2011 00:03:48 +0100
On 18/08/2011 23:22, dvint@xxxxxxxxx wrote:
I think I know the answer to this question, but would like to see if I
mssied something.

I;m using the following template in my conversion effort. This si teh
default handling for any element that I don't have something specific to
do on it:

<xsl:template match="*">
	<xsl:element  name="{name()}">
		<xsl:for-each select="@*">
			<xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
		</xsl:for-each>
that for-each is a verbose way of writing <xsl:copy-of select="@*"/> (apart from some namespace effects)

<xsl:apply-templates/> </xsl:element> </xsl:template>



This works great except for places where the element has some default value in the schema. So instead of getting<refdm> as output, I get:

you'd need to suppress the schema processing, or at least the defaulting. using a basic rather than a schema-aware processor would work, unless you need the schema aware behaviour elsewhere, or you could use a catalog or entity resolver to switch in a schema that didn't default, or your processor might have an option to suppress defaulting (saxon does for example:
-expand:on|off Expand defaults defined in schema/DTD
)


David

--
google plus: https:/profiles.google.com/d.p.carlisle

Current Thread