Complex XSLt query for Data Viewer web part in Sharepoint


I am using Data Viewer Web part to show data from a sharepoint list after applying certain conditions to it.

As per my initial requirement, I was supposed to show data from the list that satisfied the below criteria:

<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[contains(normalize-space(@Program), 'BCare') and contains(normalize-space(@Functional_x0020_Unit), 'ClientServices')]" />

I created this as an xslt in the 'Filter' ->Add xslt filtering feature of Dataview Webpart using SPD.The above line got rendered on the Code view of the page.

Now as per the new requirement, I have to add some additional logic. There is a check box field in my list 'Private Flag'.I believe Check Box fields are boolean values.

If <Private Flag> is checked, then do not use the above xslt when retreiving data, else use the above xslt for retreiving data.

I created the following below and replaced the portion of code view with "<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[contains(normalize-space(@Program), 'BCare') and contains(normalize-space(@Functional_x0020_Unit), 'ClientServices')]" />",

with my new code:

<xsl:when test="@Private_x0020_Flag = 1">  
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[contains(normalize-space(@Program), 'Care') and contains(normalize-space(@Functional_x0020_Unit), 'ClientServices')]" />

This does not work and gives an error on rendering the data view web part.I am very new to xslt.Please suggest what is going wrong here.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I know nothing about Sharepoint, but things were looking quiet in this thread, so I did a bit of hunting.

Based on this thread:

I get the impression that checkboxes are not boolean, but carry a text value (presumably the content of the checkbox element's value attribute). So if your checkbox is something like

<input type="checkbox" name="Private Flag" value="hitMe" />

maybe your XSLT needs to read something like <xsl:when test="@Private_x0020_Flag = 'hitMe'">

Just a stab in the dark, though.
subhorachanaAuthor Commented:
This works:

<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[  (@Private_x0020_Flag = '0') or  (contains(@Program, 'Care') and contains(@Functional_x0020_Unit, 'ClientServices') and (@Private_x0020_Flag = '1')) ]" />

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.