473,386 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

2 easy questions XML <==>XSLT

Hi all,

1) I have created a huge XML "data base" consisting of people with
<name>Charlie</name> <address>High street></address> etc.

I wanna use this xml-data base for various HTM-pages for me to surf to; one
could be to list all red-haireds on one htm-page, or all people with income
10,000. In other words many HTM-pages based upon the same data base, i.e.

ONE file "people.xml".

I can create various xslt-files to achieve these "output"-htm-screens.

But only ONE can be seen, since I have to code the name of the xslt-file
inside the xml-code
<?xml-stylesheet type ="text/xsl" href="redhaireds.xsl"?>

How do I solve this??

2) Within the tags in my XML-file
<description> bla bla bla</description> I want to have HTML-functions
visible within the text, e.g- one specific word will be bold (How do I write
<B> within the text ??) or a line break (How do I write <BR> ?)

Thanks!
Peter
Jul 20 '05 #1
2 1868
> Hi all,

1) I have created a huge XML "data base" consisting of people with
<name>Charlie</name> <address>High street></address> etc.

I wanna use this xml-data base for various HTM-pages for me to surf to; one could be to list all red-haireds on one htm-page, or all people with income
10,000. In other words many HTM-pages based upon the same data base,

i.e. ONE file "people.xml".

I can create various xslt-files to achieve these "output"-htm-screens.

But only ONE can be seen, since I have to code the name of the xslt-file
inside the xml-code
<?xml-stylesheet type ="text/xsl" href="redhaireds.xsl"?>

How do I solve this??
Don't use the "xml-stylesheet" processing instruction.
Instead, use script as part of the html page. This script will create the
two DOM objects and load them with the source xml document and with the
stylesheet. Then it will execute a method, which actually performs the
transformation.

How this is done is vendor - specific and you must read the documentation
provided by the vendor of the specific XSLT processor you're using. For
example in the case of MSXML4 this is described in the MSXML4 SDK
documentation.


2) Within the tags in my XML-file
<description> bla bla bla</description> I want to have HTML-functions
visible within the text, e.g- one specific word will be bold (How do I write <B> within the text ??) or a line break (How do I write <BR> ?)


<someText>Normal and <b>bold</b>text and <br /> a second line of
text</someText>

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
Jul 20 '05 #2
On Fri, 31 Oct 2003 20:26:32 +0000, Peter David wrote:
Hi all,

1) I have created a huge XML "data base" consisting of people with
<name>Charlie</name> <address>High street></address> etc.

I wanna use this xml-data base for various HTM-pages for me to surf to;
one could be to list all red-haireds on one htm-page, or all people with
income
10,000. In other words many HTM-pages based upon the same data base,
i.e. ONE file "people.xml".

I can create various xslt-files to achieve these "output"-htm-screens.

But only ONE can be seen, since I have to code the name of the xslt-file
inside the xml-code
<?xml-stylesheet type ="text/xsl" href="redhaireds.xsl"?>

How do I solve this??


use an XML framework like Apache Cocoon or create the html documents using
an xslt processor like Xalan: there you can define the stylesheet to be
used. but far better then using xalan directly is using the style target
in apache ant.

2) Within the tags in my XML-file
<description> bla bla bla</description> I want to have HTML-functions
visible within the text, e.g- one specific word will be bold (How do I
write <B> within the text ??) or a line break (How do I write <BR> ?)


(1) dont mix visual with generic markup

(2) if you *really* cannot avoid it, there is no problem in writing:

<description>bla bla <b>bla</bla><br/> blabla </description>

you just have to write a fitting XSLT stylesheet.

btw. the code above is also called "mixed content": you find it in any XML
book/tutorial.
alex
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Christopher Boomer | last post by:
I am relatively new to the world of XML and python, and I think I am still missing some of the basic concepts. It cannot be as hard as I think, or programmers would be flocking to it the way they...
1
by: Lisa | last post by:
I need to apply the HTML formatting tags and the French accented characters in a XML document. The XML is generated from a database that has HTML tags and French accented characters in the records....
2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
37
by: Steven Bethard | last post by:
The PEP below should be mostly self explanatory. I'll try to keep the most updated versions available at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
1
by: Robert Dodier | last post by:
Hello, Sorry for asking what must be a FAQ, but I wasn't able to find the answer. I have an XML document fragment which I want to store as a text string. I want a function to convert any XML...
0
by: elsheh | last post by:
Hi….. Everyone I’m using xslt to convert my XML doc. into xhtml. When I use IE or Mozilla browsers to display xhtml doc., the result is fine. However, using X_Smiles result in <br> loses its...
17
by: roN | last post by:
Hi, I'm creating a Website with divs and i do have some troubles, to make it looking the same way in Firefox and IE (tested with IE7). I checked it with the e3c validator and it says: " This...
3
by: elsheh | last post by:
Hi. Everyone I’m using xslt styllesheet to transform my xml doc. into an html doc. The task includes embedding some JavaScript code for validation purpose, till this point there is no problem...
4
by: mark4asp | last post by:
I have an element, report which contains tags which have been transformed. E.g. <pis &lt;p&gt <myXml> <report>This text has html tags in it.&lt;p&gt which but <has been changed to &lt;&gt</report>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.