namespace in root
Posted: Fri May 03, 2013 11:13 pm
I am really new to xslt. I am trying to transform a xml file using xslt 2.0 in oxygen using the Saxon-EE 9.4.0.6 transformer.
Here's the xml:
<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet href='../codebook2-0.xsl' type='text/xsl'?>
<codeBook xmlns="http://www.icpsr.umich.edu/DDI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.icpsr.umich.edu/DDI http://www.icpsr.umich.edu/DDI/Version1-3.xsd">
<docDscr source="archive">
<citation>
<titlStmt source="archive">
<titl source="archive">Work Trends Poll: Laid Off--American Workers and Employers Assess a Volatile Labor Market</titl>
</titlStmt>
<holdings URI="http://www.ropercenter.uconn.edu/cgi-bi ... RKTRENDS14"/>
</citation>
</docDscr>
</codeBook>
When I apply this sample stylesheet:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Title of study</h2>
<h1><xsl:value-of select="codeBook/docDscr/citation/titlStmt/titl"/></h1>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The only result is my text that I put in h2 or Title of Study.
If I remove the xmlns="http://www.icpsr.umich.edu/DDI" from the root <codeBook>, then this stylesheet works fine.
I'm just wondering if someone can explain why removing this xmlns declaration from the root <codeBook> would have that effect.
Thanks for the help.
Here's the xml:
<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet href='../codebook2-0.xsl' type='text/xsl'?>
<codeBook xmlns="http://www.icpsr.umich.edu/DDI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.icpsr.umich.edu/DDI http://www.icpsr.umich.edu/DDI/Version1-3.xsd">
<docDscr source="archive">
<citation>
<titlStmt source="archive">
<titl source="archive">Work Trends Poll: Laid Off--American Workers and Employers Assess a Volatile Labor Market</titl>
</titlStmt>
<holdings URI="http://www.ropercenter.uconn.edu/cgi-bi ... RKTRENDS14"/>
</citation>
</docDscr>
</codeBook>
When I apply this sample stylesheet:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Title of study</h2>
<h1><xsl:value-of select="codeBook/docDscr/citation/titlStmt/titl"/></h1>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The only result is my text that I put in h2 or Title of Study.
If I remove the xmlns="http://www.icpsr.umich.edu/DDI" from the root <codeBook>, then this stylesheet works fine.
I'm just wondering if someone can explain why removing this xmlns declaration from the root <codeBook> would have that effect.
Thanks for the help.