xsl-list
[Top] [All Lists]

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

2011-08-18 18:04:00
On 18/08/2011 23:22, dvint(_at_)dvint(_dot_)com 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>