Difference output when using XSLT Debugger versus XPath/XQuery Builder
Posted: Thu Jan 19, 2023 3:14 pm
Hi,
I am troubleshooting a transform problem and have tested the XML and XSLT in both Oxygen Editor XSLT Debugger and XPath/XQuery Builder. I am getting different output from each and don't understand why.
Firstly I have applied this XSLT to the XML below
and the output is
However, if I instead use the XPath/XQuery Builder and apply the following XPath to the same XML
The result is
Can someone explain why the output is different from both approaches to applying XSLT to XML?
Any advice appreciated,
Regards,
Ann
I am troubleshooting a transform problem and have tested the XML and XSLT in both Oxygen Editor XSLT Debugger and XPath/XQuery Builder. I am getting different output from each and don't understand why.
Firstly I have applied this XSLT to the XML below
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs" version="2.0">
<xsl:variable name="topicTitle">
<xsl:value-of select="*[
contains(@class, ' topic/topic ')]/*[contains(@class, ' topic/title ')]">
</xsl:value-of>
</xsl:variable>
<xsl:template match="*[contains(@class, ' topic/topic ')]">
<topicTitle>
<xsl:choose>
<!-- Investigate: Map's nav title is always up to date. -->
<xsl:when test="not($topicTitle='')">
<xsl:value-of select="normalize-space($topicTitle)"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>Title not found</xsl:message>
</xsl:otherwise>
</xsl:choose>
</topicTitle>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<task
xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"
class="- topic/topic task/task "
ditaarch:DITAArchVersion="1.2"
domains="(topic task) (topic hi-d) (topic ut-d) (topic indexing-d) (topic hazard-d) (topic abbrev-d) (topic pr-d) (topic sw-d) (topic ui-d) (topic task strictTaskbody-c)"
id="GUID-B0A2B437-00A2-4A3A-863E-02F6330415BB"
xml:lang="en-US">
<title id="GUID-97B53FD5-32EB-4ACD-BDE2-5FC35C5AD912" class="- topic/title ">
<ph id="GUID-D05C0990-7BAE-4463-9A33-E4086E2489D9"
class="- topic/ph ">
<ph id="d7e29"
ishcondition="(country=Australia) or (country=Canada)
or (country=Japan) or (country='United States')"
class="- topic/ph ">Your device named ABC</ph>
</ph> is Out of Sync
</title>
</task>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<topicTitle>Your device named ABC is Out of Sync</topicTitle>
Code: Select all
/*[contains(@class, ' topic/topic ')]/[contains(@class, ' topic/title ')]
Code: Select all
is Out of Sync
Any advice appreciated,
Regards,
Ann