C
clover2411
Hi there,
Apologies if I'm posting to the wrong group; this one looked to be the
best match.
I'm having trouble writing a bit of XSL/XPATH and wondered if someone
would please shed some light. My XML is generated by InfoPath and of
the structure:
....
<my:Alpha>
<my:Beta>
<my:Gamma>
<div xmlns="http://www.w3.org/1999/xhtml">one line of text</div>
<div xmlns="http://www.w3.org/1999/xhtml">another one</div>
</my:Gamma>
</my:Beta>
<my:Beta>
<my:Gamma>just the one line here
</my:Gamma>
</my:Beta>
</my:Alpha>
....
Note the my:Gamma node - sometimes it will contain divs separating
pieces of text, other times just text. In my XSL I'm trying to test
whether my:Gamma contains divs (if it does, then I can get value-of
div, otherwise I can just get value-of my:Gamma).
I'm trying to use the below construct:
<xsl:choose>
<xsl:when test="div">
...
</xsl:when>
<xsltherwise>
...
</xsltherwise>
</xsl:choose>
This works if I get rid of the xmlns="http://www.w3.org/1999/xhtml"
from the div tags, but I can't seem to write a valid test condition in
the xsl:when that will find the full <div
xmlns="http://www.w3.org/1999/xhtml"> tag. I thought <xsl:when
test="div[@*]"> might work but it doesn't seem to, leading me to think
that 'xmlns' isn't classified as an attribute as such. Maybe it's
blindingly obvious but I haven't been able to find an answer!
Many thanks in advance.
Apologies if I'm posting to the wrong group; this one looked to be the
best match.
I'm having trouble writing a bit of XSL/XPATH and wondered if someone
would please shed some light. My XML is generated by InfoPath and of
the structure:
....
<my:Alpha>
<my:Beta>
<my:Gamma>
<div xmlns="http://www.w3.org/1999/xhtml">one line of text</div>
<div xmlns="http://www.w3.org/1999/xhtml">another one</div>
</my:Gamma>
</my:Beta>
<my:Beta>
<my:Gamma>just the one line here
</my:Gamma>
</my:Beta>
</my:Alpha>
....
Note the my:Gamma node - sometimes it will contain divs separating
pieces of text, other times just text. In my XSL I'm trying to test
whether my:Gamma contains divs (if it does, then I can get value-of
div, otherwise I can just get value-of my:Gamma).
I'm trying to use the below construct:
<xsl:choose>
<xsl:when test="div">
...
</xsl:when>
<xsltherwise>
...
</xsltherwise>
</xsl:choose>
This works if I get rid of the xmlns="http://www.w3.org/1999/xhtml"
from the div tags, but I can't seem to write a valid test condition in
the xsl:when that will find the full <div
xmlns="http://www.w3.org/1999/xhtml"> tag. I thought <xsl:when
test="div[@*]"> might work but it doesn't seem to, leading me to think
that 'xmlns' isn't classified as an attribute as such. Maybe it's
blindingly obvious but I haven't been able to find an answer!
Many thanks in advance.