xsl-list
[Top] [All Lists]

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

2011-08-18 19:45:18
At 04:03 PM 8/18/2011, you wrote:
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)


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.




                <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
)

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.

thanks

..dan




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>
--~--


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

Panoramic Photography
http://www.dvint.com

voice: 619-938-3610

--~------------------------------------------------------------------
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>