Click here to Skip to main content
15,895,667 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralXSLT - HTML Pin
hatim_ali7-Oct-04 18:28
hatim_ali7-Oct-04 18:28 
GeneralRe: XSLT - HTML Pin
Christian Graus19-Oct-04 10:10
protectorChristian Graus19-Oct-04 10:10 
GeneralRe: XSLT - HTML Pin
Het210926-Oct-04 3:10
Het210926-Oct-04 3:10 
Generalmsxml DOM and character entities Pin
necroleak6-Oct-04 6:03
sussnecroleak6-Oct-04 6:03 
GeneralXML & character entities Pin
necroleak6-Oct-04 1:01
sussnecroleak6-Oct-04 1:01 
GeneralRe: XML & character entities Pin
necroleak6-Oct-04 2:42
sussnecroleak6-Oct-04 2:42 
GeneralWrite XmlElement Pin
Aubyone5-Oct-04 19:49
Aubyone5-Oct-04 19:49 
Generalusing xslt params to search for elements Pin
Mike Hodnick2-Oct-04 18:30
Mike Hodnick2-Oct-04 18:30 
I'd like to pass a parameter into an XSLT to search for a specific element within an XML document. My document has this form:


<library>
<folder id="1">
<file />
<file />
</folder>
<folder id="2">
<file />
<folder id="3" />
<folder id="4">
<file />
<file />
</folder>
</folder>
</library>

I want to be able to pass in a parameter into my XSLT and search for a particular folder - let's say id="4".

This is how I've been approaching it:

<xsl:stylesheet ...>
<xsl:param name="folderID" />
<xsl:template match="/library//folder[@id=$folderID]">
<!-- more code here -->
</xsl:template>
</xsl:stylesheet>

But I get this error: System.Xml.Xsl.XsltException: '/library//folder[@id=$folderID]' is an invalid XPath expression. ---> System.Xml.XPath.XPathException: /library//folder[@id=$folderID] is an invalid key pattern. It either has a variable reference or key function.

What might be a better or more correct way to approach this?

Michael Hodnick

GeneralRe: using xslt params to search for elements Pin
Mike Ellison2-Oct-04 18:38
Mike Ellison2-Oct-04 18:38 
GeneralRe: using xslt params to search for elements Pin
Mike Hodnick2-Oct-04 18:56
Mike Hodnick2-Oct-04 18:56 
GeneralRe: using xslt params to search for elements Pin
Stuart Dootson2-Oct-04 22:04
professionalStuart Dootson2-Oct-04 22:04 
GeneralRe: using xslt params to search for elements Pin
Stuart Dootson2-Oct-04 22:36
professionalStuart Dootson2-Oct-04 22:36 
GeneralRe: using xslt params to search for elements Pin
Mike Hodnick3-Oct-04 2:07
Mike Hodnick3-Oct-04 2:07 
GeneralMY very own language Pin
shiko2-Oct-04 7:26
shiko2-Oct-04 7:26 
GeneralRe: MY very own language Pin
Alex Korchemniy16-Oct-04 11:27
Alex Korchemniy16-Oct-04 11:27 
QuestionHow to populate grid without reforming an xml Pin
manivannan.p2-Oct-04 2:05
manivannan.p2-Oct-04 2:05 
GeneralXSL For Loop Problem while using variable Pin
jjjkkk1-Oct-04 12:21
jjjkkk1-Oct-04 12:21 
GeneralRe: XSL For Loop Problem while using variable Pin
Mike Ellison1-Oct-04 20:06
Mike Ellison1-Oct-04 20:06 
GeneralRe: XSL For Loop Problem while using variable Pin
jjjkkk4-Oct-04 12:08
jjjkkk4-Oct-04 12:08 
GeneralRe: XSL For Loop Problem while using variable Pin
jjjkkk4-Oct-04 12:16
jjjkkk4-Oct-04 12:16 
GeneralSaving an xml node alone Pin
Member 10971171-Oct-04 11:55
Member 10971171-Oct-04 11:55 
GeneralRe: Saving an xml node alone Pin
necroleak7-Oct-04 1:16
sussnecroleak7-Oct-04 1:16 
GeneralRe: Saving an xml node alone Pin
Member 10971177-Oct-04 9:57
Member 10971177-Oct-04 9:57 
Generalusing XML to save info..please help Pin
jmahdi30-Sep-04 11:17
jmahdi30-Sep-04 11:17 
GeneralRe: using XML to save info..please help Pin
jmahdi6-Oct-04 3:17
jmahdi6-Oct-04 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.