I am migrating an XSL translation and the new XML input no longer has an XML namespace.
The XSL below used to output "Test Headline" but now produces nothing.
Old XML:
<article xmlns:as="http://www.company.com/schemas/articleschema">
<parastyles>
<parastyle name="Body Copy" uid="292"/>
<parastyle name="Headline Regular" uid="311"/>
</parastyles>
<charstyles>
<charstyle name="Character Style 1" uid="285"/>
</charstyles>
<story name="head">
<runs>
<run p="311" c="285">Test Headline</run>
</runs>
</story>
<story name="body">
<runs>
<run p="292" c="285">
<eol hyphenated="true"/>Met facipsam lam sinti do<eol/>lorendae dem endae lita sim
<eol hyphenated="true"/>fuga. Nam, ut que venda es si<eol/>tame nimin con ex exerisque
</run>
</runs>
</story>
</article>
New XML:
<article xmlns="http://www.company.com/schemas/articleschema">
<parastyles>
<parastyle name="Body Copy" uid="292"/>
<parastyle name="Headline Regular" uid="311"/>
</parastyles>
<charstyles>
<charstyle name="Character Style 1" uid="285"/>
</charstyles>
<story name="head">
<runs>
<run p="311" c="285">Test Headline</run>
</runs>
</story>
<story name="body">
<runs>
<run p="292" c="285">
<eol hyphenated="true"/>Met facipsam lam sinti do<eol/>lorendae dem endae lita sim
<eol hyphenated="true"/>fuga. Nam, ut que venda es si<eol/>tame nimin con ex exerisque
</run>
</runs>
</story>
</article>
The only difference is the change in namespace: xmlns:as
Here is my XSL that works on the old XML but not on the new XML:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:apply-templates select="//story[@name='head']"/>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
<xsl:template match="eol[@hyphenated]">
<xsl:text></xsl:text>
</xsl:template>
<xsl:template match="eol">
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
I'm sure it's something ridiculously simple, but I'm not familiar enough with namespaces to figure it out. Thanks in advance!
Update -- XSL Solution:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:as="http://www.company.com/schemas/articleschema"
exclude-result-prefixes="as">
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:apply-templates select="//as:story[@name='head']"/>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
<xsl:template match="eol[@hyphenated]">
<xsl:text></xsl:text>
</xsl:template>
<xsl:template match="eol">
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>