Want to build the ChatGPT based Apps? Start here
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Prasun Kanakam
2.2k
6
452
Transformation of XML to HTML using XSLt
May 17 2019 10:19 AM
I have an XML as:
<
a
>
<
b
>
<
c
>
<
source
>
<
title
value
=
"Apple"
/>
some more tags
.
.
.
</
source
>
<
source
>
<
title
value
=
"Mango"
/>
some more tags
.
.
.
</
source
>
<
source
>
<
title
value
=
"Banana"
/>
some more tags
.
.
.
</
source
>
<
source
>
<
title
value
=
" Grapes"
/>
<
some
more tags
>
.
.
.
</
source
>
</
c
>
</
b
>
</
a
>
Based on my input(supose if my input is "title = Banana" I want to display all info related that tag.
I want to display the selected <title> and related <tags> values under that.
eg: Mango, Banana
XSLT :
<
xsl:template
match
=
"/"
>
<
html
>
<
body
>
<
xsl:apply-templates
select
=
"source"
/>
</
body
>
</
html
>
</
xsl:template
>
<
xsl:template
match
=
"source"
>
<
xsl:choose
>
<
xsl:when
test
=
"source[@value='Banana']"
>
<
xsl:value-of
select
=
"source[@value='Banana']"
/>
</
xsl:when
>
<
xsl:otherwise
>
<
xsl:value-of
select
=
"$untitled_section"
/>
</
xsl:otherwise
>
</
xsl:choose
>
</
xsl:template
>
Desire HTML output:
Banana
(some more tags deatils)......
(some more tags deatils)......
(some more tags deatils)......
(some more tags deatils)......
(some more tags deatils)......
Reply
Answers (
2
)
How to get activeCell no. with NPOI DLL in C#
Abstract class with maximum member of given classes