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

Subject: Re: [xsl] stop the processing of default attributes?
From: Dan Vint <dvint@xxxxxxxxx>
Date: Thu, 18 Aug 2011 17:45:08 -0700
At 04:03 PM 8/18/2011, you wrote:
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>
that for-each is a verbose way of writing <xsl:copy-of select="@*"/> (apart from some namespace effects)

Interesting, I haven't seen copy of for anything other than elements. What sort of namespace affects are you alluding to? I am trying to get my output to replicate the input as best possible.


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

Ok, that is confirmation of what I was expecting. I am using saxon, so I might give this a try. At the point I'm doing this processing I'm not trying to validate, just do a search and replace on some content.




google plus: https:/

--------------------------------------------------------------------------- Danny Vint

Panoramic Photography

voice: 619-938-3610

Current Thread