XML + XSL links (beguinner)

hi all
 
I'll try to explain you what i have
 in my XML file i have this:
 
Code :

    * <book>
    *   <content>
    *     <paragraphe>lorem ipsum.......</paragraphe>
    *     <paragraphe>dolor sit amet ....</paragraphe>
    *     <paragraphe>consectetuer adipiscing <link url="http://www.google.com">google</lien></paragraphe>
    *   </content>
    * </book>


 
in my stylesheet i have
 
Code :
    *.............
    * <xsl:template match="/">
    * <head>
    * <title>book</title>
    * </head>
    *
    * <body>
    *     <xsl:apply-templates/>  
    * </body>
    * </html>
    * </xsl:template>
    *
    * <xsl:template name="paragraphe">
    *         <p> <xsl:value-of select="."/></p>
    *         <xsl:apply-templates/>    
    * </xsl:template>
    *
    * <xsl:template match="//link">
    *    
    *     <a href="{@url}">
    *     <xsl:value-of select="." />
    *     </a>
    *    
    * </xsl:template>
    *
    * </xsl:stylesheet>


 
 so what i want, is that each paragraph shows independant using <p>

And, and this is the most important, whenever it finds a LINK ELEMENT, child of paragraphe or no, it must display it's content as a valid link .. for example here it's google(google must be underlined and clickable)
 
the stylesheet that i'm having is not working correctly, so could you plz help me with that
(i'm still a beguinner with XML)

Thx a lot in advance
LVL 5
jalalmegadethAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Eduard GherguLeader SibiuCommented:
Hello!

First of all change:
paragraphe>consectetuer adipiscing <link url="http://www.google.com">google</lien></paragraphe>
to
paragraphe>consectetuer adipiscing <link url="http://www.google.com">google</link></paragraphe>

Please, let me know if it is working now...
0
WelkinMazeCommented:
Hi,
Wouldn't </lien> be </link>?
0
suprapto45Commented:
Will this help?

http://www.devx.com/tips/Tip/21599

David
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

suprapto45Commented:
>>"Wouldn't </lien> be </link>?"
That is good point. I never saw that.

Points to both ghergu and WelkinMaze if it works !!! I do not deserve points here ;)

David
0
jalalmegadethAuthor Commented:
yes yes, i'm sorry

in fact it's LINK instead of lien
even in the XML file it's link :))

i'm sorry about that


even with that, it'S not working

any help? :)
0
jalalmegadethAuthor Commented:
in fact i have to correct the codes that i posted earlier ...

XML file :
Code :

    * <book>
    *   <content>
    *     <paragraphe>lorem ipsum.......</paragraphe>
    *     <paragraphe>dolor sit amet ....</paragraphe>
    *     <paragraphe>consectetuer adipiscing <link url="http://www.google.com">google</link></paragraphe>
    *   </content>
    * </book>


 
in my stylesheet i have
 
Code :
    *.............
    * <xsl:template match="/">
    * <head>
    * <title>book</title>
    * </head>
    *
    * <body>
    *     <xsl:apply-templates/>  
    * </body>
    * </html>
    * </xsl:template>
    *
    * <xsl:template match="paragraphe">
    *         <p> <xsl:value-of select="."/></p>
    *         <xsl:apply-templates/>    
    * </xsl:template>
    *
    * <xsl:template match="//link">
    *    
    *     <a href="{@url}">
    *     <xsl:value-of select="." />
    *     </a>
    *    
    * </xsl:template>
    *
    * </xsl:stylesheet>



This is what i have in fact

and what it displays, is the text in paragraphs, but no links are displayed

like this :

lorem ipsum.......
dolor sit amet ....
consectetuer adipiscing google(no link)

help plz :))
0
Eduard GherguLeader SibiuCommented:
Hello!

Please, try to change:
...
    * <xsl:template match="//link">
    *    
    *     <a href="{@url}">
    *     <xsl:value-of select="." />
    *     </a>
    *    
    * </xsl:template>
...
with
    * <xsl:template match="//link">
    *    
    *     <a href="{@url}">
    *     <xsl:value-of select="." />
    *     </a>
    *    <xsl:apply-templates/>
    * </xsl:template>
0
WelkinMazeCommented:
Try to change:

    * <xsl:template match="paragraphe">
    *         <p> <xsl:value-of select="."/></p>
    *         <xsl:apply-templates/>    
    * </xsl:template>

with this one:

    * <xsl:template match="paragraphe">
    *         <p> <xsl:apply-templates/></p>
    * </xsl:template>

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jalalmegadethAuthor Commented:
>>>>>>>>>>>>>@gherghu

when i make the changes you told me here's what i get

lorem ipsum.......
lorem ipsum.......

dolor sit amet ....
dolor sit amet ....

consectetuer adipiscing google(no link)
consectetuer adipiscing google(link)google(no link)


>>>>>>>>>>@WelkinMaze
when i make the changes you told me here's what i get

lorem ipsum.......
lorem ipsum.......

dolor sit amet ....
dolor sit amet ....

consectetuer adipiscing google(link)
consectetuer adipiscing google(link)




as you see guys, the problem that i'm having now, is that it displays everything twice ?
what can i do to resolve that ?
0
WelkinMazeCommented:
Hm, can you try the one below again as it is.
I've tried it and it works fine here.
I have a suspicion that you've tried my suggestion in combination with the gherghu's one.

    *.............
    * <xsl:template match="/">
    * <head>
    * <title>book</title>
    * </head>
    *
    * <body>
    *     <xsl:apply-templates/>  
    * </body>
    * </html>
    * </xsl:template>
    *
    * <xsl:template match="paragraphe">
    *         <p> <xsl:apply-templates/></p>
    * </xsl:template>
    *
    * <xsl:template match="//link">
    *    
    *     <a href="{@url}">
    *     <xsl:value-of select="." />
    *     </a>
    *    
    * </xsl:template>
    *
    * </xsl:stylesheet>
0
jalalmegadethAuthor Commented:
Ohhhhhh yes !!! yes WelkinMaze you're right

It works just fine !! thanks a lot !! :)
in fact i don't even know what was wrong !
thx a lot again, you saved me ! :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.