473,508 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSL Param with XPath expressions

1 New Member
Hi !

I'm making a XSL that returns distinct values from a XML Element, but the element is dynamic, so i pass it from the server as a Parameter.

XSL:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="xml" />
  4.  
  5. <xsl:param name="puff" />
  6. <Element>
  7.     <xsl:template match="/">            
  8.         <xsl:for-each select="//$puff[not(.=preceding::$puff)]">
  9.             <value><xsl:value-of select="." /></value>        
  10.         </xsl:for-each>
  11.  
  12.     </xsl:template>
  13.  
  14. </Element>
  15. </xsl:stylesheet>
It gives me syntax error when i use the param in the xpath expressions.. any solution? Thanks in advance
Jun 1 '07 #1
1 3240
dorinbogdan
839 Recognized Expert Contributor
Welcome to TheScripts TSDN...

Try this way:
Expand|Select|Wrap|Line Numbers
  1. ...
  2. <xsl:for-each select="concat('//', $puff, '[not(.=preceding::', $puff, ')]')">
  3. ...
Jun 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5803
by: Kevin | last post by:
I know this has probably been discussed many times before (I found answers when I searched yesterday), but I still can't get it to work... I have an attribute @OID that can contain any...
1
5445
by: kurt hansen | last post by:
hi I thought that this would be easy, but maybe not so much. I want to: pass an xpath expression and a string value to a stylesheet and copy the source xml document, changing the value of...
2
2018
by: arthuryeung198 | last post by:
Hi all, I got a JSP using JSTL to transform XML to HTML, and I want to pass a variable "statusFilter" into the XSL. e.g. <x:parse xml="${xml}" var="doc" /> <x:transform xml="${doc}"...
1
2225
by: Arndt Jonasson | last post by:
The definition of XPath 1.0 says "A QName in the node test is expanded into an expanded-name using the namespace declarations from the expression context. This is the same way expansion is done...
4
9100
by: syed.akhlaq | last post by:
Hi, Does anyone know how can I validate XPath expressions using xsd schema? Thanks
4
2789
by: Weston | last post by:
Are there any quick, reliable shortcuts to determine if two arbitrary XPath expressions yield result sets that intersect? The obviously way would be to iterate over the set of nodes from one...
1
3087
by: reyesvsn | last post by:
Hello everybody, I have a question concerning XPath expressions and namespaces. Consider this XML: <?xml version="1.0" encoding="UTF-8"?> <newsMessage ...
4
9031
by: ducttape | last post by:
Hi, I have been trying for several days to read XML files into my program. I have been following several good tutorials on the internet, but I am struggling because the particular XML files that I...
0
7324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7382
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7495
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5052
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1556
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.