Using XSLT, I need to remove a complete table column (header + body cells) when a column contains only “0.00” or “-“.
i.e. If all the values in the cells of one or more columns are 0.00/- then the whole column(s) should be removed.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I have assumed that you mean’t to say if all the data cells of the column are 0.00/- then remove it, not just one of them. If I have misunderstood, please advise and I will update the solution style-sheets accordingly.
There are a lot of different ways and options to create tables, and so your solution will need to be adjusted to the type and structure of your table. Shown here is a solution for a simple form of table.
XSLT 1.0 Solution
This XSLT 1.0 style-sheet…
…when applied to this input document…
…will yield…
Only one column is removed – the one with all “empty” non-header cells.
XSLT 2.0 Solution
And here is the XSLT 2.0 equivalent…