You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Roopesh Kumar <ro...@yahoo.com> on 2003/12/11 17:32:46 UTC

Problems with empty tags

Hi all

I have the following problems with using the xalan
transformer.

1. When i have a <br/> as a part of my xsl it gets
transformed to a <br>

2. When i have a <script></script> as a part of my xsl
 it gets transformed as <script/> . What should i do
to retain the closing tags in my transformed xml/html
output

3. It seems like having a CDATA section directly as a
part of the xsl file does not work. whereas having it
as a part of <xsl:text> </xsl:text> works fine..

4. What is the best way to override special characters
that come as a part of the xsl file??


Thanks

Roopesh
Software Engineer
Verizon Data Services India Ltd.


=====
Luv
Roopesh
Software Engineer 
Verizon Data Services India 
[98842-40222]

__________________________________________________________________

One manages uncertainty; one does not solve it.  
Eliminating uncertainty eliminates opportunity.  
Chaos is the engine of evolution.

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

Re: Problems with empty tags

Posted by Joseph Kesselman <ke...@us.ibm.com>.



> 1. When i have a <br/> as a part of my xsl it gets
> transformed to a <br>

Required behavior when the output mode is HTML. It shouldn't happen when
the output mode is XML; XML requires that all tags be explicitly closed.


> 2. When i have a <script></script> as a part of my xsl
> it gets transformed as <script/>.

That *shouldn't* be happening when the output mode is HTML, but should
happen when the output mode is XML. XML considers those two forms
completely equivalent.

So if you're really seeing both the above behaviors as output of a single
transformation, I'm more than a little surprised.


>3. It seems like having a CDATA section directly as a
>part of the xsl file does not work. whereas having it
>as a part of <xsl:text> </xsl:text> works fine..

I'm not sure what you mean by "does not work". If you mean that it's output
as text rather than as a CDATA Section: that's normal XSLT behavior. CDATA
sections are fully expanded as they're read in, then output using the
stylesheet's normal rules for that element type. To set those rules see the
cdata-section-elements parameter of xsl:output.


>4. What is the best way to override special characters
>that come as a part of the xsl file??

I'm not sure what you mean by "override". If the characters are there and
are legal XML characters, they will be processed. XML serialization will
either output them directly (if the output document's encoding supports
them), or represent them as numeric character references, or (if
cdata-section-elements applies) generate <![CDATA[]]> markup. If you want
to discard them, or replace them with something else, you have to write the
stylesheet logic to do the appropriate string manipulation.



______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk