troubleshooting Question

how can I put two conditions in template match ?

Avatar of tech_question
tech_question asked on
Web Languages and Standards
3 Comments1 Solution1552 ViewsLast Modified:
my xml is like this :

<f1_author1>test</f1_author1>
<f2_author1>test1</f2_author1>
<f3_author1>test2</f3_author1>

<f1_author_id>123</f1_author_id>
<f2_author_id></f2_author_id>
<f3_author_id>4545</f3_author_id>

any record that has empty "_author1" eg: f1_author1, f2_author1, f3_author1 tags and has an "author_id" value I need to add "click here value" to all the "_author1" fields.

what is the xsl to do this ? I have the below xsl to do this. I could not add a "and" condition to the the xsl. how can
I do this ?

<xsl:template match="*[contains(name(), '_author1')]" >
		<xsl:element name="{name()}">
			<xsl:choose>
				<xsl:when test="string-length(text()) = 0">
					<xsl:text>click here</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>{text()}</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:element>
	</xsl:template>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros