You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Octavian Istrate <oc...@yahoo.com> on 2001/03/17 02:15:35 UTC

how can I UNSUBSCRIBE???????????????

--- Scott_Boag@lotus.com wrote:
> 
> > The XML output cannot be
> > a="x
> > y"
> > This is because XML 1.0 requires newline
> characters in attribute values
> to
> > be normalized into spaces but requires character
> references to newline
> > characters not to be normalized.
> 
> Yeah, I may have mis-spoke in my reply to Christian
> about being able to add
> newlines in attributes.
> 
> Let me start again, because I think this discussion
> is getting pretty
> confusing (at least for my sleepy brain).
> 
> Given the base test included at the end of this
> note, the output will be:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <out x="AttribValue"/>
> 
> This should be the case no matter if you are using a
> DOM, ContentHandler,
> or whatever.  The whitespace in between
> xsl:attribute and xsl:value-of is
> not significant unless you have xml:space="preserve"
> in effect.  If you
> find different, I would be *very* interested (and
> glad to find the bug).
> 
> If I change the xsl:attribute portion of the
> stylesheet to be:
> 
>            <xsl:attribute name="x"
> xml:space="preserve">
>                <xsl:value-of
> select="/a:section/b:subsection/@attr" />
>           </xsl:attribute>
> 
> ...then my output will be:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <out x="
             AttribValue
          
> "/>
> 
> However, a SAX2 ContentHandler listening to the
> result will get real
> newlines in the character's event's character array,
> *not* the characters "
> 
".  The escaping of newlines is part of the
> serialization stage.  When
> you have a ContentHandler, is it pre-serialization. 
> In other words, the
> serializer itself is a ContentHandler at the same
> place as your
> ContentHandler, so you replaced the serializer and
> it is up to you to do
> the proper serialization or not.  Characters have to
> be passed to the
> ContentHandler without character references in them.
> 
> Other tests:
> 
>            <xsl:attribute name="x">
>                <xsl:value-of
> select="/a:section/b:subsection/@attr" />x
>           </xsl:attribute>
> 
> yields:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <out x="AttribValuex
            "/>
> 
> test:
> 
>            <xsl:attribute name="x">
>                <xsl:value-of
> select="/a:section/b:subsection/@attr" />

>           </xsl:attribute>
> 
> yields:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <out x="AttribValue"/>
> 
> test:
> 
>            <xsl:attribute name="x">
>                <xsl:value-of
> select="/a:section/b:subsection/@attr" />
>                <xsl:text>
</xsl:text>
>           </xsl:attribute>
> 
> yields:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <out x="AttribValue
"/>
> 
> All these seem good and consistent with the spec, I
> think.
> 
> Now, modifying the test to do:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:a="http://somewhere.someplace.org"
> xmlns:b="http://other.otherplace.org"
> exclude-result-prefixes="a b">
>   <xsl:output method="html"/>
> 
>   <xsl:template match="/">
>        <html><body>
>            <xsl:attribute name="style">
>                <xsl:value-of
> select="/a:section/b:subsection/@attr" />
>                <xsl:text>
</xsl:text>
>           </xsl:attribute>
>        </body></html>
>   </xsl:template>
> </xsl:stylesheet>
> 
> yields:
> 
> <html>
> <body style="AttribValue
> "></body>
> </html>
> 
> i.e. the same newline escaping applied to HTML is
> not used... newline
> escaping is just an XML issue.  So, since Christian
> stated "I want the
> Xalan html output nicely formatted", maybe I was
> still correct in my reply.
> 
> Does this clear anything up?  Or just confuse things
> more?  :-)
> 
> -scott
> 
> == XML ==
> <?xml version="1.0" encoding="UTF-16"?>
> <section name="First"
> xmlns="http://somewhere.someplace.org"
> xmlns:b="http://other.otherplace.org">
>            <b:subsection attr="AttribValue"/>
> </section>
> 
> == XSL ==
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:a="http://somewhere.someplace.org"
> xmlns:b="http://other.otherplace.org"
> exclude-result-prefixes="a b">
>   <xsl:output method="xml" media-type="text/xml"/>
> 
>   <xsl:template match="/">
>        <out>
>            <xsl:attribute name="x">
>                <xsl:value-of
> select="/a:section/b:subsection/@attr" />
>           </xsl:attribute>
>        </out>
>   </xsl:template>
> </xsl:stylesheet>
> 
> 
> 
> 
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/