[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Typing Variable as AnyURI - Problem

Subject: Typing Variable as AnyURI - Problem
From: Ihe Onwuka <ihe.onwuka@xxxxxxxxxxxxxx>
Date: Thu, 13 Sep 2012 07:14:07 +0100
 Typing Variable as AnyURI - Problem
This stylesheet is supposed to construct an HTTP call.

If I type the variable VMSCall as anyURI I get

net.sf.saxon.trans.XPathException: A sequence of more than one item is
not allowed as the value of variable $VMScall

With the casting in the call to the document function (and an untyped
variable) it works however if the variable is typed (despite casting
to anyURI) it still yields the above error.

If the call to the document function is cast as xs:string I get
net.sf.saxon.trans.XPathException: Exception thrown by URIResolver

My expectation is that if I type the variable as anyURI it should work
without the need to cast the document call. AAMOF I also expected the
call to work without having to type the variable or cast the document
function call.



Stylesheet

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:oc="http://extend.com/opencase/2.0"
        version="2.0">
    <xsl:output indent="yes" omit-xml-declaration="yes"/>
    <xsl:template match="/">
       <xsl:variable name="VMScall" ><xsl:apply-templates/></xsl:variable>
       <xsl:value-of select="document(xs:anyURI($VMScall))"/>
    </xsl:template>
    <xsl:template match="feed">
       <xsl:text>http://blah?entityType=VOD&amp;filters=beid:equals:[</xsl:text>
       <xsl:apply-templates select="product"/>]
    </xsl:template>
    <xsl:template match="product">
       <xsl:apply-templates select="descendant::oc:bundle/externalID"/>
       <xsl:if test="not(position()=last())">,</xsl:if>
    </xsl:template>
</xsl:stylesheet>


Cutdown XML

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:media="http://search.yahoo.com/mrss/"
      xmlns:oc="http://extend.com/opencase/2.0"
      xmlns:ocmedia="http://extend.com/opencase/2.0/ocmedia">

   <product>

            <oc:bundle>
               <name>VoD_70</name>
               <altCode/>
               <uuid>4c219204-4bd9-42d9-8b39-9bd7f2b43a93</uuid>
               <externalID>Asset_0097_VoD_70</externalID>

               <createDate>2012-08-17T14:48:47.863Z</createDate>
               <lastModified>2012-08-17T14:51:16.237Z</lastModified>
               <isActive>true</isActive>
            </oc:bundle>
</product>
<product>
            <oc:bundle>
               <name>VoD_150</name>
               <altCode/>
               <uuid>7a93f556-cf0c-4761-8642-f5013b83b03f</uuid>
               <externalID>Asset_0177_VoD_150</externalID>

               <createDate>2012-08-17T14:48:59.820Z</createDate>
               <lastModified>2012-08-17T14:51:17.127Z</lastModified>
               <isActive>true</isActive>
            </oc:bundle>
</product>
</feed>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.