tellaston
October 26th, 2011, 02:31 PM
I am doing xslt transformation on a sample xmldoc using the xslt below. The problem I am having is its not matching on 'Publication'. If I remove the namespace it works fine. Is there a way to get the match on the 'Publication' tag with the namespace?
----Sample XML------
<?xml version="1.0" encoding="utf-8"?>
<Publication xmlns="http://www.mycompany.com/Sampleproject/XmlSchema">
<PublicationDetails>
<AgencyId>1</AgencyId>
<PublicationId>PublicationId1</PublicationId>
<PublicationDateTime>1900-01-01T01:01:01-07:00</PublicationDateTime>
<OriginatingSystemName>OriginatingSystemName1</OriginatingSystemName>
<DestinationSystemName>DestinationSystemName1</DestinationSystemName>
</Publication>
---- Sample Xslt ------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl: output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Publication">
<xsl:apply-templates select ="PublicationDetails"/>
</xsl:template>
<xsl:template match="PublicationDetails">
<SubmittingAgency>
</SubmittingAgency>
</xsl:template>
</xsl:stylesheet>
----Sample XML------
<?xml version="1.0" encoding="utf-8"?>
<Publication xmlns="http://www.mycompany.com/Sampleproject/XmlSchema">
<PublicationDetails>
<AgencyId>1</AgencyId>
<PublicationId>PublicationId1</PublicationId>
<PublicationDateTime>1900-01-01T01:01:01-07:00</PublicationDateTime>
<OriginatingSystemName>OriginatingSystemName1</OriginatingSystemName>
<DestinationSystemName>DestinationSystemName1</DestinationSystemName>
</Publication>
---- Sample Xslt ------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl: output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Publication">
<xsl:apply-templates select ="PublicationDetails"/>
</xsl:template>
<xsl:template match="PublicationDetails">
<SubmittingAgency>
</SubmittingAgency>
</xsl:template>
</xsl:stylesheet>