hello,
I'm a bit new to XSL and I'm trying to do the following: I have an XML file with a number of profiles in it (profile.xml). I wrote a profile.xsl to transform these files into a nice readable format. Now the user would like to filter these xml files based upon a profile of their choice on the client. I have modified my profile.xsl file to include this filter by hand and it works perfectly. The problem is that I need to read this "filter" from an external file (because it can change) and this is where I have tried to use the document function. Here are some examples of my files:
Profile.xml (shortened):
etc...
here is my Profile.xsl (shortened):
here is my testing.xml file:
This item in my xsl is my problem (I believe):
the document function does not return a node set in this case, which is what the for-each is looking for. I've tried to use the node-set() function from xmlns:exsl="htt p://exslt.org/common"> but this has not worked. I am able to verify that the document() is reading the correct string value from the testing.xml file, but for-each just will not use it.
Does anyone know what I am doing wrong?
Thanks in advance,
Pete
I'm a bit new to XSL and I'm trying to do the following: I have an XML file with a number of profiles in it (profile.xml). I wrote a profile.xsl to transform these files into a nice readable format. Now the user would like to filter these xml files based upon a profile of their choice on the client. I have modified my profile.xsl file to include this filter by hand and it works perfectly. The problem is that I need to read this "filter" from an external file (because it can change) and this is where I have tried to use the document function. Here are some examples of my files:
Profile.xml (shortened):
Code:
<Main>
<profile id="Profile_1">
<title>title1</title>
</profile>
<profile id="Profile_2">
<title>title2</title>
</profile>
<profile id="Profile_3">
<title>title3</title>
</profile>
</Main>
here is my Profile.xsl (shortened):
Code:
<!--This works....--> <xsl:for-each select="Main/profile[@id=Profile_1']"> <!--This one does not--> <!--<xsl:for-each select="document(testing.xml')/ProfileSelection/SelectedProfile)">--> <td > <xsl:value-of select="@id"/> <xsl:value-of select="title"/> <xsl:apply-templates select="select"> </xsl:apply-templates> </xsl:for-each>
Code:
<?xml version="1.0" encoding="utf-8"?> <ProfileSelection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <SelectedProfile>Benchmark/profile[@id=Profile_1']</SelectedProfile> </ProfileSelection>
Code:
<!--<xsl:for-each select="document(testing.xml')/ProfileSelection/SelectedProfile)">-->
Does anyone know what I am doing wrong?
Thanks in advance,
Pete
Comment