Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: XML -- in dire need of assistance
Ooops made a small logical mistake
Henning Follmann <H.Follmann_at_gmx.de> writes:
> I suggest to use XSLT to transform your primarely output.
> (Sorry offtopic)
>
>
> ----------------------------------------------------------
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
> <xsl:output method="xml"/>
>
> <xsl:template match="/">
> <xsl:apply-templates select="Person"/>
> </xsl:template>
>
> <xsl:template match="Person">
> <Person>
> <Name>
> <xsl:value-of select="./Name"/>
> </Name>
> <xsl:apply-template select="Address"/>
> </Person>
> </xsl:template>
>
>
> <xsl:template match="Address">
> <Address>
> <Street>
> <xsl:value-of select="./Address_item/Street"/>
> </Street>
> <City>
> <xsl:value-of select="./Address_item/City"/>
> </City>
> </Address>
> </xsl:template>
replace previuos template with the two following:
<xsl:template match="Address">
<xsl:apply-template select="Address_item"/> </xsl:template>
<xsl:template match="Address_item">
<Address> <Street> <xsl:value-of select="Street"/> </Street> <City> <xsl:value-of select="City"/> </City> </Address>
>
>
>
> </xsl:stylesheet>
> ------------------------------------------------------------
>
>
> Cheers,
> Henning
>
>
>
> "Sam Baum" <sjb_at_comcast.net> writes:
>
> > I'm using the DBMS_XMLQuery PL/SQL functions to produce an XML
document from
> > my relational tables, using an object view. As far as I can tell,
> > everything is working as advertised. However, I have one problem that I
> > just can't resolve and any insight would be most appreciated.
> >
> > The output of the XML document looks like this:
> >
> > <Person>
> > <Name>Bob</Name>
> > <Address>
> > <Address_item>
> > <Street>123 Mystreet</Street>
> > <City>My City</City>
> > </Address_item>
> > <Address_item>
> > <Street>456 Mystreet</Street>
> > <City>My City</City>
> > </Address_item>
> > </Address>
> > </Person>
> >
> > The problem is the DTD requires me to repeat the Address element and drop
> > the Address_item element. The correct output needs to look like this:
> >
> > <Person>
> > <Name>Bob</Name>
> > <Address>
> > <Street>123 Mystreet</Street>
> > <City>My City</City>
> > </Address>
> > <Address>
> > <Street>456 Mystreet</Street>
> > <City>My City</City>
> > </Address>
> > </Person>
> >
> > I am at a complete loss. Does anyone know who to get Oracle to do this?
> >
> > Thanks in advance for your help.
> >
> > Sam Baum
> >
> >
> >
> >
>
> --
> Henning Follmann | H.Follmann_at_gmx.de
> 8 Jane Road | (+1)(908) 464 8972
> New Providence, NJ 07974 | USA
>
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> Check out our new Unlimited Server. No Download or Time Limits!
> -----== Over 80,000 Newsgroups - 19 Different Servers! ==-----
-- Henning Follmann | H.Follmann_at_gmx.de 8 Jane Road | (+1)(908) 464 8972 New Providence, NJ 07974 | USA -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==-----Received on Thu Jan 17 2002 - 09:42:14 CST