Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 29th, 2005, 09:58 AM
Registered User
 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default get node & childs in a DB

The problem I have is:

I want to send a compete set of nodes (inkl. tags!) to the database.

--------- in my XSLT -----------
<xsl:variable name="all_kopf">
  <xsl:copy-of select="kopf"/>
</xsl:variable>

------- insert in DB -------
<sql:insert connection="$connection" table="vbi">
  <sql:column name="kopf" select="$all_kopf"/>
</sql:insert>

the value of the variable (all_kopf) is right, but if I insert it to the DB all the tags are lost!

for the better understanding:

------- my XML ------
<kopf>
  <tag1>foobar</tag1>
</kopf>

result of all_kopf: <kopf><tag1>foobar</tag1></kopf>
result in the DB: foobar
expected result in the DB: <kopf><tag1>foobar</tag1></kopf>

PS: I know that this is not the way to normaly store data, but I was asked to do so

Can anybody please help me

THX in advance

attention: noob on the way
 
Old September 29th, 2005, 10:12 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This code looks as if you are using the Saxon SQL extension, is that right?

If you want to store serialized XML in the database, create a string holding the serialized data, by calling saxon:serialize(), and then store the resulting string.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old September 29th, 2005, 10:20 AM
Registered User
 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wow now I'm realy impressed! THX a lot Mr Kay!

Yes, I'm using the saxon parser. (for the first time and I really like it!)


attention: noob on the way





Similar Threads
Thread Thread Starter Forum Replies Last Post
Good way to select & process only one node traxwx XSLT 2 May 21st, 2007 05:08 PM
XML from a DB recordset (removal of &lt;&gt;) Thodoris XML 3 July 13th, 2004 12:28 AM
ASP & DB breeze76 Classic ASP Databases 3 April 23rd, 2004 03:06 AM
Creating & comparing node sets skipw XSLT 3 February 21st, 2004 05:51 AM
Trying to get node name of childs children keldan XML 1 August 1st, 2003 03:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.