Solved

xasp: name space objects XSL

Posted on 2009-07-11
6
797 Views
Last Modified: 2013-11-18
I have the following code in another application that workes fine
namespace declaration xmlns:xasp="urn:asp-objects">

    <xsl:variable name="offer-url">
      <xsl:value-of select="yahoo:Url" />
</xsl:variable>
 <xsl:variable name="offer-url-encoded">
      <xsl:value-of select="xasp:encodeURL(string(yahoo:Url))" />
</xsl:variable>

I am trying to re use this in another xsl but i am getting this error

Error in XPath expression
Unknown function - Name and number of arguments do not match any function signature in the static context - 'urn:asp-objects:encodeURL'

can anyone help me with this please
0
Comment
Question by:QuinnDester
  • 3
  • 3
6 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24831845
this is either an external function,
so you will need a bunch of other things
including making the extension function library accessible
(eg. if java, make sure the jar is on the classpath)

or this is a XSLT2 function,
make sure that yu include the definition then and that your stylesheet is an XSLT2 stylesheet and you have an XSLT2 processor

lots of things that cann go wrong.

I think it would b esmart if you posted both the XSLT that had this working and the XSLT that has this not working

cheers

Geert
0
 
LVL 3

Author Comment

by:QuinnDester
ID: 24831868
Thanks Geert

Ill post these in 2 posts as they are on different computers.

Here is the xsl that this function works in.
<?xml version="1.0" encoding="utf-8" ?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xasp="urn:asp-objects">

<xsl:template match="/">
 

<div id="maincontent">

	<!--variable for parsing links - set in glbMain-->

	<xsl:variable name="url2sub">

		 <xsl:value-of select="xasp:GetRequestVariable('url2','session')" />

	</xsl:variable>
 

	<!--2nd variable for parsing links - set in glbMain-->

	<xsl:variable name="url2sub2">

		 <xsl:value-of select="xasp:GetRequestVariable('url2sub2','session')" />

	</xsl:variable>
 

	<!--variables for back link-->

	<xsl:variable name="back1">

		<xsl:value-of select="substring(//parent-form/url2,$url2sub,18)" />

	</xsl:variable>

	<xsl:variable name="back2">

		<xsl:value-of select="substring(//form/url2,$url2sub,11)" />

	</xsl:variable>

	<xsl:variable name="back3">

		<xsl:value-of select="//form/@id" />

	</xsl:variable>

	<xsl:variable name="backmain">

		<xsl:value-of select="substring(//parent-form/url2,$url2sub)" />

	</xsl:variable>

	<xsl:variable name="backcat">

			<xsl:value-of select="substring(//top-level-form/url2,$url2sub)" />

	</xsl:variable>

	<xsl:variable name="cn">

		<xsl:value-of select="//top-level-form/name" />

	</xsl:variable>
 
 

	<!-- build the crumbtrail -->

	<ul class="crumbtrail">

		<li><a href="index.asp">Home</a>&#160;::</li>

		<li><a href="index.asp?cat={$backcat}&amp;cn={$cn}"><xsl:value-of select="//top-level-form/name" /></a>&#160;::</li>

		<xsl:if test="not(//top-level-form/name=//parent-form/name)">

			<li><a href="index.asp?cat={$backmain}"><xsl:value-of select="//parent-form/name" /></a>&#160;::</li>

		</xsl:if>

		<li><a href="index.asp?cat={$back1}{$back2}{$back3}"><xsl:value-of select="//category/title" />&#160;</a></li>

		<xsl:for-each select="//bread-crumbs/crumb">

			<xsl:variable name="url-value">

				<xsl:value-of select="@url-value" />

			</xsl:variable>

			<xsl:if test="@type='attribute'">

				<li>::&#160;<a href="index.asp?cat={$back1}{$back2}{$back3}/keyword-/dnatrs-{$url-value}"><xsl:value-of select="@display-value" /></a></li>

			</xsl:if>

		</xsl:for-each>

	</ul>
 

	<!-- Main Content -->

	<div id="mainresults">

		<table cellspacing="0" cellpadding="0" border="0">

			<tr>

				<td class="nopadding" colspan="4">

					<h1>Items Found (<xsl:value-of select="//domain/domain-listing/hybrid-items/@total" />)</h1>

				</td>

			</tr>

			<tr>

				<td class="nopadding" colspan="4">

					<!-- get session variable for link-->

					<xsl:variable name="catid">

						<xsl:value-of select="substring(//form/url2,$url2sub)" />

					</xsl:variable>
 

					<!-- get session variable for sort order-->

					<xsl:variable name="so">

						<xsl:value-of select="xasp:GetRequestVariable('so','session')" />

					</xsl:variable>
 

					<!-- build variable for narrowing down the results -->

					<xsl:variable name="narrow">

						<xsl:for-each select="//bread-crumbs/crumb">

							<xsl:if test="@type='attribute'">

								<xsl:value-of select="concat(@url-value,'-')" />

							</xsl:if>

						</xsl:for-each>

					</xsl:variable>
 

					<!-- get session variable for page no-->

					<xsl:variable name="pg">

						<xsl:value-of select="xasp:GetRequestVariable('pg','session')" />

					</xsl:variable>
 

					<!-- get session variable for sortby-->

					<xsl:variable name="sb">

						<xsl:value-of select="xasp:GetRequestVariable('sb','session')" />

					</xsl:variable>
 

					<!-- build sort by links -->

					<div class="sortbar">

						Sort by:

						<xsl:choose>

							<xsl:when test="$sb=0">

								<xsl:choose>

									<xsl:when test="$so=2">

										<a class="selected" href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=0&amp;so={$so}">Best match

										<img style="vertical-align:top;" border="0" src="sort.gif" /></a>&#160;&#160;

									</xsl:when>

									<xsl:otherwise>

										<a class="selected" href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=0&amp;so={$so}">Best match

										<img style="vertical-align:top;" border="0" src="sortdesc.gif" /></a>&#160;&#160;

									</xsl:otherwise>

								</xsl:choose>

							</xsl:when>

							<xsl:otherwise>

								<a href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=0&amp;so={$so}">Best match</a>&#160;&#160;

							</xsl:otherwise>

						</xsl:choose>
 

						<xsl:choose>

							<xsl:when test="$sb=2">

								<xsl:choose>

									<xsl:when test="$so=2">

										<a class="selected" href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=2&amp;so={$so}">Price

										<img style="vertical-align:top;" border="0" src="sort.gif" /></a>&#160;&#160;

									</xsl:when>

									<xsl:otherwise>

										<a class="selected" href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=2&amp;so={$so}">Price

										<img style="vertical-align:top;" border="0" src="sortdesc.gif" /></a>&#160;&#160;

									</xsl:otherwise>

								</xsl:choose>

							</xsl:when>

							<xsl:otherwise>

								<a href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=2&amp;so={$so}">Price</a>&#160;&#160;

							</xsl:otherwise>

						</xsl:choose>
 

						<xsl:choose>

							<xsl:when test="$sb=3">

								<xsl:choose>

									<xsl:when test="$so=2">

										<a class="selected" href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=3&amp;so={$so}">Store Name

										<img style="vertical-align:top;" border="0" src="sort.gif" /></a>&#160;&#160;

									</xsl:when>

									<xsl:otherwise>

										<a class="selected" href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=3&amp;so={$so}">Store Name

										<img style="vertical-align:top;" border="0" src="sortdesc.gif" /></a>&#160;&#160;

									</xsl:otherwise>

								</xsl:choose>

							</xsl:when>

							<xsl:otherwise>

								<a href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=3&amp;so={$so}">Store Name</a>&#160;&#160;

							</xsl:otherwise>

						</xsl:choose>
 

						<xsl:choose>

							<xsl:when test="$sb=5">

								<xsl:choose>

									<xsl:when test="$so=2">

										<a class="selected" href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=5&amp;so={$so}">Store Rating

										<img style="vertical-align:top;" border="0" src="sort.gif" /></a>&#160;&#160;

									</xsl:when>

									<xsl:otherwise>

										<a class="selected" href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=5&amp;so={$so}">Store Rating

										<img style="vertical-align:top;" border="0" src="sortdesc.gif" /></a>&#160;&#160;

									</xsl:otherwise>

								</xsl:choose>

							</xsl:when>

							<xsl:otherwise>

								<a href="index.asp?cat={$catid}/dnatrs-{$narrow}&amp;sb=5&amp;so={$so}">Store Rating</a>&#160;&#160;

							</xsl:otherwise>

						</xsl:choose>

					</div>

				</td>

			</tr>
 

			<!-- display the products -->

			<xsl:for-each select="//domain/domain-listing/hybrid-items/store-offer">

				<!--path for product image-->

				<xsl:variable name="offer-image">

					<xsl:value-of select="offer-image" />

				</xsl:variable>
 

				<!--path for store logo-->

				<xsl:variable name="store-logo">

					<xsl:value-of select="store-logo" />

				</xsl:variable>
 

				<!-- path for store-rating-image -->

				<xsl:variable name="store-rating-image">

					<xsl:value-of select="store-rating-image" />

				</xsl:variable>
 

				<!--url for deal-->

				<xsl:variable name="offer-url">

					<xsl:value-of select="offer-url" />

				</xsl:variable>
 

				<!-- url encoded offer-url link so that we can pass it through to a redirect.asp page -->

				<xsl:variable name="offer-url-encoded">

					<xsl:value-of select="xasp:encodeURL(string(offer-url))" />

				</xsl:variable>
 

				<tr>

					<td>

						<img src="{$offer-image}" />

					</td>

					<td valign="top">

						<strong><a href="redirect.asp?target={$offer-url-encoded}" target="_blank"><xsl:value-of select="offer-name" /></a></strong><br/><br/>

						<xsl:value-of select="offer-description" /><br/><br/>

						<strong>In stock:</strong>&#160;<xsl:value-of select="in-stock" /><br/>

						<xsl:if test="not(string-length(stock-description)=0)">

							<strong>Availability:</strong>&#160;<xsl:value-of select="stock-description" /><br/><br/>

						</xsl:if>

					</td>

					<td width="20%" align="center">

						<img src="{$store-logo}" /><br/><br/>

						<xsl:choose>

							<xsl:when test="(string-length($store-rating-image)=0)">

								Not Reviewed

							</xsl:when>

							<xsl:otherwise>

								<img src="{$store-rating-image}" /><br/><br/>

							</xsl:otherwise>

						</xsl:choose>

					</td>

					<td width="20%" align="center" valign="center">

						<br/>&#163;<xsl:value-of select="format-number(offer-price,'###,##0.00')" /><br/>

						P&amp;P <xsl:value-of select="shipping" /><br/>

						<strong>&#163;

						<xsl:choose>

							<xsl:when test="string(number(total-price))='NaN'">

								<xsl:value-of select="total-price" />

							</xsl:when>

							<xsl:otherwise>

								<xsl:value-of select="format-number(total-price,'###,##0.00')" />

							</xsl:otherwise>

						</xsl:choose>

						</strong><br/>

						<a href="redirect.asp?target={$offer-url-encoded}" target="_blank"><img style="margin:8px 0px;" src="buynow2.gif" border="0" /></a><br/>

						<a href="redirect.asp?target={$offer-url-encoded}" target="_blank"><xsl:value-of select="store-name" /></a><br/><br/>

					</td>

				</tr>

			</xsl:for-each>

		</table>

	</div>
 

	<!-- show "narrow results by" column -->

	<xsl:choose>

		<xsl:when test="//attribute-list/attribute">

			<div id="narrowresults">

				<h1>Narrow results by</h1>

				<xsl:for-each select="//attribute-list/attribute">

					<h2><xsl:value-of select="@name" /></h2>

					<div class="narrowresultscontent">

						<xsl:for-each select="attr-value">

							<xsl:variable name="filter">

								<xsl:value-of select="substring(url2,$url2sub2)" />

							</xsl:variable>

							<a href="index.asp?cat={$filter}"><xsl:value-of select="name" /></a>&#160;<span class="smallcounter">(<xsl:value-of select="count" />)</span><br/>

						</xsl:for-each><br/>

					</div>

				</xsl:for-each>

			</div>

		</xsl:when>

		<xsl:otherwise>

			<div id="narrowresults">

				<h1>Narrow results by</h1>

				<xsl:variable name="results">

					<xsl:value-of select="//domain/domain-listing/hybrid-items/@total" />

				</xsl:variable>
 

				<xsl:choose>

					<xsl:when test="$results=1">

						<div class="narrowresultscontent"><strong>There is <xsl:value-of select="$results" /> item that

						matched your selection.</strong> There are no additional ways to narrow down these results.</div>

					</xsl:when>

					<xsl:otherwise>

						<div class="narrowresultscontent"><strong>There are <xsl:value-of select="$results" /> items that

						matched your selection.</strong> There are no additional ways to narrow down these results.</div>

					</xsl:otherwise>

				</xsl:choose>

			</div>

		</xsl:otherwise>

	</xsl:choose>

</div>

</xsl:template>

</xsl:stylesheet>

Open in new window

0
 
LVL 3

Author Comment

by:QuinnDester
ID: 24831875
here is the one that doesnt work,
<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"

    xmlns:user="urn:comparionsplus-com:xslt"

    xmlns:yahoo="urn:yahoo:prods"

    xmlns:xasp="urn:asp-objects">

    <xsl:output method="html"/>

    <xsl:template match="/">

        <html>

            <body>

                <xsl:apply-templates select="yahoo:ProductSearch/yahoo:Products"/>

            </body>

        </html>

    </xsl:template>

    <xsl:template match="yahoo:ProductSearch/yahoo:Products">
 

            

        <xsl:apply-templates select="yahoo:Product/yahoo:Offer"/>

    </xsl:template>

    	<xsl:variable name="offer-url">

					<xsl:value-of select="yahoo:Url" />

				</xsl:variable>

    				<xsl:variable name="offer-url-encoded">

					<xsl:value-of select="xasp:encodeURL(string(yahoo:Url))" />

				</xsl:variable>
 

    <xsl:template match="yahoo:Products/yahoo:Product/yahoo:Offer">

<div class="clear"></div>

<div class="products">

      <table align="center" class="style2" bgcolor="ffffff" cellpadding="3" border="1">

        <tr>

            <td align="center" class="style23" rowspan="3">

                     <a>

      

       <xsl:attribute name="href">redirect.aspx?target=<xsl:value-of select="$offer-url-encoded"/>

       </xsl:attribute>

       

       <img>

       <xsl:attribute name="src" >

       

       <xsl:value-of select="yahoo:ListImage/yahoo:Url"/>

       </xsl:attribute> 

       <xsl:attribute name="border"> <xsl:value-of select="0"/>

       </xsl:attribute>

       <xsl:attribute name="alt">

       <xsl:value-of select="yahoo:ProductName"/>

       </xsl:attribute>

       </img>

       <input><xsl:attribute name="name"><xsl:text>productLink</xsl:text></xsl:attribute><xsl:attribute name="type"><xsl:text>hidden</xsl:text></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="$offer-url-encoded"/></xsl:attribute></input>

       </a></td>

            <td class="style27" colspan="3">

                <xsl:value-of select="yahoo:ProductName"/></td>

            <td class="style19">

                Price</td>

            <td align="center" class="style9">

                 <xsl:value-of select="yahoo:Price"/> GBP</td>

        </tr>

        <tr>

            <td colspan="3" rowspan="2">
 

              <xsl:value-of select="translate(normalize-space(yahoo:Summary), '#', '')"/>

            </td>

            <td class="style19">

                Delivery</td>

            <td align="center" class="style9">

                <xsl:value-of select="yahoo:DeliveryCost"/> GBP</td>

        </tr>

        <tr>

            <td align="center" class="style10" colspan="2">

               

                <xsl:value-of select="yahoo:Availability"/></td>

        </tr>

        <tr>

            <td class="style23">

                Category</td>

            <td align="center" colspan="2">

                <a><xsl:attribute name="href">home.aspx?catid=<xsl:value-of select="yahoo:Category/@id"/>&amp;title=<xsl:value-of select="translate(normalize-space(yahoo:Category/yahoo:Name), ' ', '_')"/></xsl:attribute><xsl:value-of select="yahoo:Category/yahoo:Name"/></a></td>

            <td align="center" colspan="2"> 

                <xsl:value-of select="yahoo:Merchant/yahoo:Name"/>

 </td>

            <td align="center" class="style10" colspan="2">

           <div> 

           <a>
 

  <xsl:attribute name="href"><xsl:text>redirect.aspx</xsl:text></xsl:attribute>Buy Now

  

    <input>

  <xsl:attribute name="id"><xsl:text>productLink</xsl:text></xsl:attribute><xsl:attribute name="name"><xsl:text>productLink</xsl:text></xsl:attribute><xsl:attribute name="method"><xsl:text>post</xsl:text></xsl:attribute><xsl:attribute name="type"><xsl:text>hidden</xsl:text></xsl:attribute><xsl:attribute name="runat"><xsl:text>server</xsl:text></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="yahoo:Url"/></xsl:attribute>

  </input>

  </a>
 

  

</div>

</td>

        </tr>

    </table>

</div>

         <br />

    </xsl:template>

    
 

</xsl:stylesheet>

Open in new window

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24831986
yep, that is likely an extension library
what processor are you using on the computer that does work?
it is hard for me to tell how the extension library is configured.
There likely is a jar on the classpath that is included
or a .dll that is connected one way or another.
You have to make sure that you copy and configure that as wel
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 24831992
I found a reference to the library
here is how to configure it
http://www.codeproject.com/KB/asp/aspobjects_in_xsl.aspx?display=PrintAll
0
 
LVL 3

Author Comment

by:QuinnDester
ID: 24832595
Gertone, Could  i trouble you to look at this one.

In an effort to over come the problems i was having using the asp namespace i tried to create an extension object to url encode the urls.

this seems to almost right, but i cant work out where its going wrong. your help would be much appreciated.
thank You

http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_24562199.html
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with SimpleXML charts with PHP 4 84
Grunt No Clean Targets 6 109
XML XSLT If loop 4 21
MS Access XML API HTTP POST Call Object Send Not Working Correctly 15 38
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now