tags:

views:

70

answers:

2

Given an XSLT 1.x style sheet that requires parameters, is there any way to associate it with an XML document that specifies values for the parameters? I read the W3C spec document for the stylesheet PI and got left with the impression that the answer is 'no,' but I had a case of acute BNF poisoning by the time I was done, and thus might have missed something.

In more concrete terms, given:

<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>

is there any way to add some parameters that will be bound to parameters of the style sheet?

+1  A: 

Generally you want to associate a XML document with a XSLT template, not otherwise; you should go with this processing instruction:

<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>

Take a look here: Link the XSL Style Sheet to the XML Document and inspect source code.

Rubens Farias
That's what I meant. I'll edit the question.
bmargulies
+1  A: 

Your analysis is correct. The xml-stylesheet PI provides no means to pass parameters to the XSL.

You could simply add some additional attributes or elements in the XML document that contain the values you would want to paramaterise.

AnthonyWJones