Btw: Is there a way to use the SQL extensions from XQuery ? Can't find nothing about that in the documentation nor examples.

Thanks

 

Jochen



 


Von: saxon-help@lists.sourceforge.net
Gesendet: 16.03.06 17:22:08
An:
Betreff: RE: [saxon] Getting XML-data using SQL extension


Try replacing

<xsl:copy-of select="col[7]"/>

with

<xsl:copy-of select="saxon:parse(col[7])"/>

To convert lexical XML into tree form, you need to parse it, which is what
saxon:parse() does.
The other alternative is

<xsl:value-of select="col[7]" disable-output-escaping="yes"/>

which is more suitable if the data isn't well-formed, for example if it's
dirty HTML: but then you need to make sure that the transformation is
serializing its output.

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: saxon-help-admin@lists.sourceforge.net
> [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of
> Mathias Payer
> Sent: 16 March 2006 15:54
> To: saxon-help@lists.sourceforge.net
> Subject: [saxon] Getting XML-data using SQL extension
>
> Hi list,
>
> I'm tying to use saxon and the saxon sql extension to transform data
> from different db's.
>
> A field in the database contains part of an xml document. I
> now want to
> use this document inside a xsl.
>
> The problem I have is t! hat all < and > are escaped (&lt; and &gt;) and
> that I only get a "string". But I want an xml tree.
>
> To demonstrate what I'm doing I'll post a little bit of code:
>
> ...
> <xsl:variable name="connection" as="java:java.lang.Object"
> xmlns:java="http://saxon.sf.net/java-type">
> <sql:connect driver="{$driver}" database="{$datasource}"
> user="{$username}" password="{$password}"/>
> </xsl:variable>
> ...
> <xsl:variable name="rs">
> <sql:query connection="$connection" table="aenderungen"
> column="src_nr,src_zusatz,dst_artpos,typ,inkraftdatum,gueltig_
> bis,aenderung"
> where="{concat('dst_nr=',$singlequote,$lgblnr,$singlequote,'
> AND dst_zusatz=',$singlequote,$lgblzusatz,$singlequote)}"/>
> </xsl:variable>
>
> <GMGBuch>
> <xsl:for-each select="$rs//row">
> <aenderung typ="{col[4]}" dst_artpos="{col[3]}">
> <source nr="{col[1]}! " zusatz="{col[2]}"/>
> <zeitraum inkraftdatum="{col[5]}" gueltig_bis="{col[6]}"/>
> <daten>
> <xsl:copy-of select="col[7]"/>
> </daten>
> </aenderung>
> </xsl:for-each>
> </GMGBuch>
>
> The "xml"-data is in col[7]. How can I use this data as a normal xml
> document and not as string?
>
> Any help is appreciated.
>
> Regards,
> Mathias
>
> --
> Information about me, my projects and contact details:
> http://nebelwelt.net
>




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&! dat=121642
_______________________________________________
saxon -help mailing list
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help



Verschicken Sie romantische, coole und witzige Bilder per SMS!   
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193