0

There is a SharePoint webpage(pocwebpage.aspx) with XML Web Part on it and the XSLT and XML are linked on the web part. A Querystring parameter is trying to pass through URL on the XMLWeb Part page but it is not passed over XSLT during loading. The following are the data for your review,

XML

<RootData>
<Employee>
 <Name>Ramesh</Name>
</Employee>
<Employee>
 <Name>Suresh</Name>
</Employee>
<Employee>
 <Name>Ganesh</Name>
</Employee>
</RootData>

XSLT

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="param"/>
<xsl:template match="Employee">
Parameter : <xsl:value-of select="$param"/>
 <xsl:for-each select="RootData/Employee">
    Employee Name : <xsl:value-of select="Name"/>
 </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

$param returns only empty string and not retrun the query paramvalue "discovery"

Query string URL

http://sharepoint-server/sitename/pocwebpage.aspx?param=discovery

XML Webpart

Your help is very much appreciated and thanks for your help.

2 Answers 2

1

When you define a parameter you don't need $

<xsl:param name="param"/>

When you access this parameter you need $

<xsl:value-of select="$param"/>
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your reply. I have tried changing $ sign on the parameter but it is still showing empty value and the query string value is not passed over. Should I pass param explicitly and if so could you please help me out code snippet ?
@Smaug, actually I don't know how to pass parameter in sharepoint. anyway, the notation I provided above is correct way to work with parameters in XSLT.
1

Unfortunately, you can not do this with XSL - it is rendered on server-side without any data provided about query URL.

The workaround is to get query parameters by JavaScript.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.