NPE occurs in the following code (dita2wml_global_drawing.xsl):
<xsl:for-each select="$map/descendant::*[contains(@class,' bookmap/toc ')]">
<xsl:variable name="toc" as="element()" select="."/>
<xsl:variable name="tocId" as="xs:string" select="ahf:generateId($toc)"/>
<xsl:sequence select="$tocId"/>
<xsl:for-each select="$map/descendant::*[ahf:seqContains(string(@class),(' bookmap/chapter ',' bookmap/appendix ',' bookmap/indexlist'))]">
<xsl:variable name="topicRef" as="element()" select="."/>
<xsl:variable name="chapterNo" as="xs:string" select="ahf:getChapterNo($topicRef)"/>
<xsl:sequence select="concat($tocId,'-',$chapterNo)"/>
</xsl:for-each>
</xsl:for-each></code>
If I modified such as following, the NPE has been vanished.
<xsl:variable name="toc" as="element()?" select="$map/descendant::*[contains(@class,' bookmap/toc ')][1]"/>
<xsl:if test="exists($toc)">
<xsl:variable name="tocId" as="xs:string" select="ahf:generateId($toc)"/>
<xsl:sequence select="$tocId"/>
<xsl:for-each select="$map/descendant::*[ahf:seqContains(string(@class),(' bookmap/chapter ',' bookmap/appendix ',' bookmap/indexlist'))]">
<xsl:variable name="topicRef" as="element()" select="."/>
<xsl:variable name="chapterNo" as="xs:string" select="ahf:getChapterNo($topicRef)"/>
<xsl:sequence select="concat($tocId,'-',$chapterNo)"/>
</xsl:for-each>
</xsl:if></code>