Basically I need to open a div in one if statement and close it in another. I tried
<xsl:value-of select="'<div>'"/>
but that failed because < and > aren’t allowed in attributes. Any ideas?
Cheers
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.
If what you want to do is output some content regardless of any condition, but wrap the content in a
<div>depending on a condition:You can change the
<xsl:call-template>to<xsl:apply-templates>or<xsl:value-of select="$myvariable" />etc. depending on what the invariant content is.This way, you will be treating a tree structure as a tree structure, leveraging the power of an XML tree-based processor, instead of trying to fight against it. DOE may work in many instances, but it’s not portable, because XSLT processors are not required to honor it. Indeed they can’t, unless they happen to be responsible for serialization in a particular pipeline. The above method avoids this problem.