[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

trying to figure out handling namespace issues

Subject: trying to figure out handling namespace issues
From: Fred Christian <fredc@xxxxxxxxxx>
Date: Fri, 12 Dec 2008 12:20:25 -0800
 trying to figure out handling namespace issues
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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.