CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Oct 2011
    Location
    Mesa, AZ
    Posts
    6

    Question Template Match on a xml tag with a namespace

    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------
    Code:
    <?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 ------

    Code:
    <?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>
    Last edited by tellaston; October 26th, 2011 at 06:22 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured