[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Escape caracters


Subject: RE: [xsl] Escape caracters
From: "SMITH Neil" <neil.smith@xxxxxxxx>
Date: Tue, 8 Jun 2004 08:00:30 +0200

David,

Thank you for all your help, went over a part of the specification and
managed to solve my problem (I knew I had to read them some day...).

Take care
Neil.

 
-----Original Message-----
From: M. David Peterson [mailto:m.david@xxxxxxxxxx] 
Sent: mercredi, 2. juin 2004 15:29
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Escape caracters

Hey Neil,

> One more thing about these fake character references...

Believe it or not these are actually real character references.  They
are 
both real references and they reference real characters.  I understand
that 
you are not used to looking at characters like this but this is
something 
that you will need to embrace and understand or youre going to find
yourself 
getting really frustrated every time you encounter them... which is
pretty 
much every time you create a stylesheet.

> I tried to change the output method to text like this...

<xsl:output method="text" encoding="ISO-8859-1"/>

XSLT 1.0 supports three(3) output methods...  xml, html, and text.  An
XSLT 
1.0 compliant processor will follow the rules set forth in the 1.0 
specification.  Its definitely a GREAT read! ;)  Well, a MANDATORY read
none 
the less...  Before you can begin to understand why things are done a 
certain way you need to read the specification they were built against. 
Things will make a lot more sense once you have done this...  I can
promise 
you one thing.  You will save yourself about 5 days of frustration for
every 
1 hour you spend studying the specification.  With only 2.5 days left in
the 
week it might be a good idea to spend the next 1/2 day reading and the
next 
2 implementing.  I promise that you are more likely to meet your
deadline if 
you take the time to do this than if you don't.

Heres the link...  http://www.w3.org/TR/xslt

Some other great resources that help make more sense of the spec...

http://www.dpawson.co.uk/xsl/index.html

http://www.jenitennison.com/xslt/index.html


> And I don't get them any more, but the outputted text is not formatted
(no 
> margins, italic, paragraphs ...).

Once you read the spec you will understand why this is.  But in the case
of 
"text" it should be pretty obvious why you are getting this result.
Text is 
not a markup language.  So when you output as text you are literally
going 
to get the actual text representation (based on the encoding you declare
for 
your output, utf-8 if none) of a character (what would be considered by
the 
majority of the world as readable text and by you as "not fake" ;).  A
good 
example of what people might use text output for is generating source
code 
such as C++ (or any other format that doesn't have ML as part of is 
acronymic (I have no idea if that's a word but it sounds cool so Im
sticking 
with it ;) structure.)  Obviously markup character sare not a standard
part 
of the C++ syntax e.g the statement... cout &lt;&lt; "one" &lt;&lt;
endl; 
wouldn't compile all that well.  The need to output literal strings of
text 
then is mandatory for this type of output.  So instead of  &lt; it will 
output < producing the much more compilable  cout << "one" << endl;


There are certain characteristics of HTML output as well as XML output
that 
are there by design.  <?xml version="1.0"?> is the mandatory minimum as
the 
first line starting at the first character of an XML document.
Otherwise it 
would not be a valid XML file and therefore could not be parsed by an
XML 
parser.  Therefore if you set your output method to XML you are going to
get 
this as your very first line starting with your very first character.
There 
is an attribute called omit-xml-decleration that will allow you to tell
the 
processor to not output the XML declaration.  This is so you can output
XML 
data that is well formed but is not necessarily a valid XML file.  An 
example would be XHTML.  I mention this because if you were to attempt
to 
create an XHTML file using the output method of HTML you would find
yourself 
frustrated with the results. (more about why in the spec...)

> I hope it can help... I have to finish this project by the end of the 
> week...

Everyone here will help you in any way we can.  And at this point the
best 
thing anybody can do for you is to encourage you to read the spec.
There is 
no doubt you will have questions.  In fact (and I cant speak for
everybody 
here but this is probably a pretty safe blanket statement) I find myself

referencing the spec 2 or 3 times a week trying to engrain further some
of 
the more fine tuned aspects of the specification.  It's a never ending 
learning process but it does get easier... It just takes some legwork on

your part to get there first.

> Thanks for your help

Youre welcome :)

Best of luck to you Neil!  Don't hesitate to continue to ask questions. 
That's what we are here for.  And if you take the time to study on your
own 
youll find that people here are even more willing to help you gain a
greater 
understanding of the technology.

Cheers and good luck!

<M:D/>


--+------------------------------------------------------------------
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@xxxxxxxxxxxxxxxxxxxxxx>
--+-- 


--+------------------------------------------------------------------
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@xxxxxxxxxxxxxxxxxxxxxx>
--+--



Current Thread
Keywords