[Home] [By Thread] [By Date] [Recent Entries]
I continue to have problems getting my brain to understand how to handle
namespace problems. I think I have broken one down simple enough to get
help on. (Using Saxon 9)
Basically I have this xsl: <xsl:for-each select="child::*[1]"> 3)<xsl:value-of select="name(.)"/># </xsl:for-each> <xsl:for-each select="div"> 4)<xsl:value-of select="name(.)"/># </xsl:for-each> and this output: 3)div# --- The problem, there is no "4)div#" I realize it is because of a namespace problem, but I don't know how to solve it. Help? 1. Is there a way that I can write some xsl, that will give me temporary output so I can figure out what I need to add to my xsl so that "4)div#" will work without looking at the xml? (I ask this, because sometimes the xml I am working with is huge and it is easy to get lost). 2. Following are the files I am using, stripped down as much as I dared. How can I modify my XSL so the "4)div#" works with a direct select statement instead of *[1]? (because it won't always be in the first position) Thanks _________ Main XML file _________
<kbooks>
<EOUProblems>pset:7</EOUProblems>
</kbooks>________ Secondary input file psettest7.xhtml _________ <?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <div class="problemGroup"> text </div> </body> </html> ________ XSL file ____________________ <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl"> <xsl:template match="kbooks"> <root> <xsl:apply-templates select="EOUProblems"/> </root> </xsl:template> <xsl:template match="EOUProblems">
<xsl:variable name="psetDoc">psettest7.xhtml</xsl:variable>
<xsl:for-each select="document(string($psetDoc))">
<xsl:for-each select="child::*[1]">
<xsl:for-each select="child::*[1]">
<xsl:for-each select="child::*[1]">
3)<xsl:value-of select="name(.)"/>#
</xsl:for-each>
<xsl:for-each select="div">
4)<xsl:value-of select="name(.)"/>#
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:template></xsl:stylesheet>
|

Cart



