Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > 2 easy questions XML <==>XSLT

Reply
Thread Tools

2 easy questions XML <==>XSLT

 
 
Peter David
Guest
Posts: n/a
 
      10-31-2003
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


 
Reply With Quote
 
 
 
 
Dimitre Novatchev
Guest
Posts: n/a
 
      10-31-2003
> 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


 
Reply With Quote
 
 
 
 
Alexander Schatten
Guest
Posts: n/a
 
      11-01-2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy way to Convert One source XML to 4 different XML formats Jim Mitten XML 3 01-29-2008 04:55 PM
Is it reasonably easy easy to something like this with python? Bruno Desthuilliers Python 5 08-29-2007 07:40 AM
Stripping audio from qa DVD. Easy or not so easy? GJ Computer Support 1 05-23-2007 02:03 AM
easy to look at and easy to maintain web page menuing system. Hazzard ASP .Net 2 04-06-2004 03:51 AM



Advertisments