Re: [xsl] Problem with "value-of" tags in XSLT to be placed at desired location in Text Output

Subject: Re: [xsl] Problem with "value-of" tags in XSLT to be placed at desired location in Text Output
From: Jyotsna B <jbendapu@xxxxxxxxx>
Date: Mon, 22 May 2006 13:39:22 -0700 (PDT)
Thank you for the suggestions.

I realised that I pasted the wrong XSLT which is not
the working version.Sorry about that 

But anyways all the points you mentioned below are
takencare and I am in process of trying more examples.

Thanks
Jyotsna



--- Jon Gorman <jonathan.gorman@xxxxxxxxx> wrote:

> > 1)
> > These "value-of" tags in XSLT are not getting
> replaced
> > by values in XML file at the place in wanted in
> Output
> 
> They are getting replaced, but by nothing.
> 
> > 2)
> > How to get all 3 insert statements in the
> output(My
> > current output is stuck after first insert
> staement ..
> > not going back to XML file )?
> 
> Hmmm, I think you need to learn a bit more about
> xslt/xpath.
> 
> I'll comment in more detail in the section with more
> detail ;).
> 
> 
> 
> > ---------
> > XSLT File:-
> > -------
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <xsl:stylesheet version="2.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> > xmlns:xs="http://www.w3.org/2001/XMLSchema";
> > xmlns:fn="http://www.w3.org/2005/xpath-functions";
> > xmlns:xdt="http://www.w3.org/2005/xpath-datatypes";
> > >
> >         <xsl:output method="text" indent="yes"/>
> >          <xsl:template match="domain-name/server">
> 
> ^^^ ok, first issue.  So you match server nodes that
> have a parent of
> domain-name.  I don't see anything like that in the
> input element.  I
> see a domain-name that is a sibling of a server
> element, but not as a
> parent.  In fact, I'm not sure why you're getting
> any output besides
> the text values of the nodes.  Are you sure the xslt
> that you posted
> is giving the output you described?
> 
> >    insert into server (
> >
> >
>
'oracleAppVersion',java-version,java-vendor,java-vm-version,java-vm-vendor,java-vm-name,os-arch,os-name,os-version
> > ) values (
> >     <xsl:value-of
> select="/comp/weblogic-version"/>,
> 
> Remember like in Unix path names, in XPath / is a
> special symbol that
> indicates the start of the document and hence
> indicates an absolute
> path.  So it goes up to the very top of the document
> and looks for the
> element comp.  There is no element comp in the top
> of the document.
> Hence things break.
> 
> It looks like you want something like...
> <xsl:template match="server" >
> ...
> <xsl:value-of select="comp/weblogic-version" />
> 
> 
> > ------------
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <?xml-stylesheet href="file.xslt"
> type="text/xslt"?>
> >
> > <!--Sample XML file generated by XMLSpy v2006 sp1
> U
> > (http://www.altova.com)-->
> > <inventory xmlns="http://xx";
> 
> ^^^ another issue.  Your elements are in a in a
> namespace.  I really
> don't understand how you managed to get any output
> (or anything
> besides the text value of the nodes in the tree).
> 
> So you need a prefix in your xslt
> 
> ie
> <xsl:stylesheet version="2.0"
>  xmlns:x="http://xx";
> ...
> 
> and in your xpath indicate that:
> 
> <xsl:template match="x:server" >
> ...
> <xsl:value-of select="x:comp/x:weblogic-version" />
> 
> Not to sound rude, but you're asking some pretty
> basic questions.  I'd
> recommend getting some good beginner material or
> google for tutorials.
>  Start with some very simple xml and xslt samples
> until you have a
> better grasp of XPath.
> 
> 
> Jon Gorman
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread