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 December 15th, 2009, 05:47 PM
Registered User
 
Join Date: May 2009
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
Default Using <XSL:Result-Document> to post to a URL over HTTP

I was hoping I could use Saxon to post output documents directly to a content engine running on Jetty.

I am trying to skip the 'generate content to disk' step and directly upload from XSLT using <XSL:Result-Document> having noticed that Michael Kay said folks had been successfully used it with ftp and mailTo.

For reference, the following is the simple command I would give using a utility like Curl to achieve an HTTP based upload:

C:\curl http://localhost:8983/solr/update/ -F stream.file=C:\FormattedContentFromXSLT\MyUploadCo ntent.xml

My sample XSLT reads as follows:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">

    <xsl:output name="outputDefinition" method="xml" indent="yes" encoding="UTF-8"/>

    <xsl:template match="/" name="main">

        <xsl:variable name="Url" select="'http://localhost:8983/solr/update'"/>

        <xsl:for-each select="/document/content/section">
            <xsl:result-document href="{$Url}" format="outputDefinition">
                <add>
                    <doc>
                        <field name="id"
                            >[Document]2008-1stCentennialBancorp-CIK0001097081.html</field>
                        <field name="contextNumberPages">92</field>
                        <field name="contextTOCCount">20</field>
                        <field name="contextNumberSections">20</field>
                        <field name="contextNumberSubSections">1259</field>
                        <field name="contextHasPageBreaks">true</field>
                    </doc>
                </add>
            </xsl:result-document>
        </xsl:for-each>

    </xsl:template>
</xsl:stylesheet>

I am running this from Oxygen 11.0 and get the following error:

Engine name: Saxon-HE 9.2.0.2
Severity: fatal
Description: Failed while closing output file - 400 Bad Request for: http://localhost:8983/solr/update
Start location: 27:0

HTTP ERROR: 400 “missing content stream”


Most grateful for any suggestions,
 
Old December 15th, 2009, 06:56 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This question is very product-specific and would be best asked on the saxon-help mailing list at SourceForge.net - there are several people active on that list who might be able to provide more useful input than I can.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
ITEpicurean (December 15th, 2009)





Similar Threads
Thread Thread Starter Forum Replies Last Post
embedded <xsl:element> into <xsl:with-param> petergoodman XSLT 2 July 9th, 2008 06:36 AM
Performance for <xsl:import> and <xsl:include> vikkiefd XSLT 2 April 16th, 2008 08:06 AM
xsl:result-document instruction bonekrusher XSLT 3 April 12th, 2007 06:01 PM
<xsl:for-each> inside another <xsl:for-each> suersh79 XSLT 2 December 29th, 2006 01:24 AM
<xsl:choose> and <xsl:otherwise> problem djmarquette XSLT 4 January 21st, 2005 01:56 PM





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