serialize XML tree to text

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

serialize XML tree to text

Michiel Roos [netcreators]
Dear List,

I am still trying to insert a xml snippet into my postgres database
table. The one thing I have seen is that it is possible to insert say:

<blip/>

So I thought I could put an extra processor in the pipeline that
serializes my xml tree to text . . .

To my amazement orbeon eats all of my xml after serialzation.

I do not understand this.

Here's the code:

page-flow.xml:
------------------------------------------------------------------------------------------------------------------------------------------
<config xmlns="http://www.orbeon.com/oxf/controller">
  <page path-info="/replace-test/" default-submission="init.xml"
model="replace.xpl" view="view.xsl"/>
  <epilogue url="oxf:/config/epilogue.xpl"/>
</config>


init.xml:
------------------------------------------------------------------------------------------------------------------------------------------
<blip/>


replace.xpl:
------------------------------------------------------------------------------------------------------------------------------------------
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
  xmlns:oxf="http://www.orbeon.com/oxf/processors" >
  <p:param type="input" name="instance"/>
  <p:param type="output" name="data"/>
 
  <p:processor name="oxf:xslt">
    <p:input name="config" href="replace.xsl"/>
    <p:input name="data" href="#instance" debug="input"/>
    <p:output name="data" ref="data"/>
  </p:processor>
 
</p:config>


replace.xsl:
------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <xsl:value-of select="string(.)"/>
  </xsl:template>

</xsl:stylesheet>


view.xsl:
------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
  <xsl:template match="/">
    <xsl:copy-of select="."/>
  </xsl:template>
</xsl:stylesheet>



What the fsck is goin on here?

Am I missing something?


Cheers

--

Met vriendelijke groet,


Michiel Roos
netcreators.com




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: serialize XML tree to text

Ryan Puddephatt
Your XSLT is incorrect, you need to use saxon:serialize. String converts the
value of a node to a string, it doesn't serialize XML

Ryan

Ryan Puddephatt
Software Engineer

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108

 

>-----Original Message-----
>From: Michiel Roos [mailto:[hidden email]]
>Sent: 15 December 2006 17:06
>To: [hidden email]
>Subject: [ops-users] serialize XML tree to text
>
>Dear List,
>
>I am still trying to insert a xml snippet into my postgres
>database table. The one thing I have seen is that it is
>possible to insert say:
>
>&lt;blip/&gt;
>
>So I thought I could put an extra processor in the pipeline
>that serializes my xml tree to text . . .
>
>To my amazement orbeon eats all of my xml after serialzation.
>
>I do not understand this.
>
>Here's the code:
>
>page-flow.xml:
>---------------------------------------------------------------
>---------------------------------------------------------------
>------------
><config xmlns="http://www.orbeon.com/oxf/controller">
>  <page path-info="/replace-test/" default-submission="init.xml"
>model="replace.xpl" view="view.xsl"/>
>  <epilogue url="oxf:/config/epilogue.xpl"/> </config>
>
>
>init.xml:
>---------------------------------------------------------------
>---------------------------------------------------------------
>------------
><blip/>
>
>
>replace.xpl:
>---------------------------------------------------------------
>---------------------------------------------------------------
>------------
><p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>  xmlns:oxf="http://www.orbeon.com/oxf/processors" >
>  <p:param type="input" name="instance"/>
>  <p:param type="output" name="data"/>
>
>  <p:processor name="oxf:xslt">
>    <p:input name="config" href="replace.xsl"/>
>    <p:input name="data" href="#instance" debug="input"/>
>    <p:output name="data" ref="data"/>
>  </p:processor>
>
></p:config>
>
>
>replace.xsl:
>---------------------------------------------------------------
>---------------------------------------------------------------
>------------
><?xml version="1.0" encoding="UTF-8"?>
><xsl:stylesheet version="1.0"
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>  <xsl:template match="/">
>    <xsl:value-of select="string(.)"/>
>  </xsl:template>
>
></xsl:stylesheet>
>
>
>view.xsl:
>---------------------------------------------------------------
>---------------------------------------------------------------
>------------
><?xml version="1.0" encoding="UTF-8"?>
><xsl:stylesheet version="1.0"
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
>  <xsl:template match="/">
>    <xsl:copy-of select="."/>
>  </xsl:template>
></xsl:stylesheet>
>
>
>
>What the fsck is goin on here?
>
>Am I missing something?
>
>
>Cheers
>
>--
>
>Met vriendelijke groet,
>
>
>Michiel Roos
>netcreators.com
>
>
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: serialize XML tree to text

Michiel Roos [netcreators]
Alas  .. .

saxon:serialize:

<xsl:value-of select="saxon:serialize(/*, 'text')"/>

xxforms:serialize

<xsl:value-of select="xxforms:serialize(instance('instance'), 'text')"/>

Neither work.

It would be very helpfull if you could provide a working example.

cheers,


Michiel


Ryan Puddephatt wrote:
Your XSLT is incorrect, you need to use saxon:serialize. String converts the
value of a node to a string, it doesn't serialize XML

Ryan

Ryan Puddephatt
Software Engineer

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108

 

  
-----Original Message-----
From: Michiel Roos [[hidden email]] 
Sent: 15 December 2006 17:06
To: [hidden email]
Subject: [ops-users] serialize XML tree to text

Dear List,

I am still trying to insert a xml snippet into my postgres 
database table. The one thing I have seen is that it is 
possible to insert say:

&lt;blip/&gt;

So I thought I could put an extra processor in the pipeline 
that serializes my xml tree to text . . .

To my amazement orbeon eats all of my xml after serialzation.

I do not understand this.

Here's the code:

page-flow.xml:
---------------------------------------------------------------
---------------------------------------------------------------
------------
<config xmlns="http://www.orbeon.com/oxf/controller">
 <page path-info="/replace-test/" default-submission="init.xml" 
model="replace.xpl" view="view.xsl"/>
 <epilogue url="oxf:/config/epilogue.xpl"/> </config>


init.xml:
---------------------------------------------------------------
---------------------------------------------------------------
------------
<blip/>


replace.xpl:
---------------------------------------------------------------
---------------------------------------------------------------
------------
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
 xmlns:oxf="http://www.orbeon.com/oxf/processors" >
 <p:param type="input" name="instance"/>
 <p:param type="output" name="data"/>

 <p:processor name="oxf:xslt">
   <p:input name="config" href="replace.xsl"/>
   <p:input name="data" href="#instance" debug="input"/>
   <p:output name="data" ref="data"/>
 </p:processor>

</p:config>


replace.xsl:
---------------------------------------------------------------
---------------------------------------------------------------
------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:template match="/">
   <xsl:value-of select="string(.)"/>
 </xsl:template>

</xsl:stylesheet>


view.xsl:
---------------------------------------------------------------
---------------------------------------------------------------
------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
 <xsl:template match="/">
   <xsl:copy-of select="."/>
 </xsl:template>
</xsl:stylesheet>



What the fsck is goin on here?

Am I missing something?


Cheers

-- 

Met vriendelijke groet,


Michiel Roos
netcreators.com



    


  

-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


-- 

Met vriendelijke groet,


Michiel Roos
netcreators.com


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: serialize XML tree to text

Ryan Puddephatt
<xsl:stylesheet version="2.0"
    xmlns:saxon="http://saxon.sf.net/">
 
<xsl:output name="escaped" type="xml"/>
 
<xsl:template match="/*">
    <document>
        <xsl:copy-of select="saxon:serialize(.,'escaped')"/>
    </document>
</xsl:template>
</xsl:stylesheet>
 
This should work, but I haven't checked it. If it doesn't work, you should probably direct you problem to the XSL mail list as they will be able to help you more.
 
Ryan

Ryan Puddephatt
Software Engineer
 

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP
 
e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108
w> www.teleflex.com

 


From: Michiel Roos [mailto:[hidden email]]
Sent: 15 December 2006 18:30
To: [hidden email]
Subject: Re: [ops-users] serialize XML tree to text

Alas  .. .

saxon:serialize:

<xsl:value-of select="saxon:serialize(/*, 'text')"/>

xxforms:serialize

<xsl:value-of select="xxforms:serialize(instance('instance'), 'text')"/>

Neither work.

It would be very helpfull if you could provide a working example.

cheers,


Michiel


Ryan Puddephatt wrote:
Your XSLT is incorrect, you need to use saxon:serialize. String converts the
value of a node to a string, it doesn't serialize XML

Ryan

Ryan Puddephatt
Software Engineer

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108

 

  
-----Original Message-----
From: Michiel Roos [[hidden email]] 
Sent: 15 December 2006 17:06
To: [hidden email]
Subject: [ops-users] serialize XML tree to text

Dear List,

I am still trying to insert a xml snippet into my postgres 
database table. The one thing I have seen is that it is 
possible to insert say:

&lt;blip/&gt;

So I thought I could put an extra processor in the pipeline 
that serializes my xml tree to text . . .

To my amazement orbeon eats all of my xml after serialzation.

I do not understand this.

Here's the code:

page-flow.xml:
---------------------------------------------------------------
---------------------------------------------------------------
------------
<config xmlns="http://www.orbeon.com/oxf/controller">
 <page path-info="/replace-test/" default-submission="init.xml" 
model="replace.xpl" view="view.xsl"/>
 <epilogue url="oxf:/config/epilogue.xpl"/> </config>


init.xml:
---------------------------------------------------------------
---------------------------------------------------------------
------------
<blip/>


replace.xpl:
---------------------------------------------------------------
---------------------------------------------------------------
------------
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
 xmlns:oxf="http://www.orbeon.com/oxf/processors" >
 <p:param type="input" name="instance"/>
 <p:param type="output" name="data"/>

 <p:processor name="oxf:xslt">
   <p:input name="config" href="replace.xsl"/>
   <p:input name="data" href="#instance" debug="input"/>
   <p:output name="data" ref="data"/>
 </p:processor>

</p:config>


replace.xsl:
---------------------------------------------------------------
---------------------------------------------------------------
------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:template match="/">
   <xsl:value-of select="string(.)"/>
 </xsl:template>

</xsl:stylesheet>


view.xsl:
---------------------------------------------------------------
---------------------------------------------------------------
------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
 <xsl:template match="/">
   <xsl:copy-of select="."/>
 </xsl:template>
</xsl:stylesheet>



What the fsck is goin on here?

Am I missing something?


Cheers

-- 

Met vriendelijke groet,


Michiel Roos
netcreators.com



    


  

-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


-- 

Met vriendelijke groet,


Michiel Roos
netcreators.com


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: serialize XML tree to text

Michiel Roos [netcreators]
Ryan Puddephatt wrote:
<xsl:stylesheet version="2.0"
    xmlns:saxon="http://saxon.sf.net/">
 
<xsl:output name="escaped" type="xml"/>
 
<xsl:template match="/*">
    <document>
        <xsl:copy-of select="saxon:serialize(.,'escaped')"/>
    </document>
</xsl:template>
</xsl:stylesheet>
 
This should work, but I haven't checked it. If it doesn't work, you should probably direct you problem to the XSL mail list as they will be able to help you more.
Ryan,

Thank you very much for the example. It works fine (apart from the type="xml" attr.).

My error was that I did not have saxon installed . . . . Doh!

Now that it's monday, after having a nice relaxing weekend . . . I have seen the light!

;-)

Cheers,


Michiel Roos


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: serialize XML tree to text

Ryan Puddephatt
Michiel,
    You shouldn't need saxon installed, it comes with OF, but glad you got it sorted
 
Ryan
 

Ryan Puddephatt
Software Engineer
 

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP
 
e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108
w> www.teleflex.com

 


From: Michiel Roos [mailto:[hidden email]]
Sent: 18 December 2006 08:07
To: [hidden email]
Subject: Re: [ops-users] serialize XML tree to text

Ryan Puddephatt wrote:
<xsl:stylesheet version="2.0"
    xmlns:saxon="http://saxon.sf.net/">
 
<xsl:output name="escaped" type="xml"/>
 
<xsl:template match="/*">
    <document>
        <xsl:copy-of select="saxon:serialize(.,'escaped')"/>
    </document>
</xsl:template>
</xsl:stylesheet>
 
This should work, but I haven't checked it. If it doesn't work, you should probably direct you problem to the XSL mail list as they will be able to help you more.
Ryan,

Thank you very much for the example. It works fine (apart from the type="xml" attr.).

My error was that I did not have saxon installed . . . . Doh!

Now that it's monday, after having a nice relaxing weekend . . . I have seen the light!

;-)

Cheers,


Michiel Roos


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws