Hi you will have to forgive me if this has been covered in the forums, but i am having some trouble grasping the concept. I recently decided to update my schemas to use best practices I learned over the last year. Now its time to convert the XML file to the new schema.
Most of my documents are for pubishing book type documents so I use a lot of recursive elements like <Para> & <bullet>. My new schema imports all the recursive elements and does not have a namespace, but the core schema does.
Here is my problem, The below xslt is working fine except for my PARA elements. If the <PARA> is recursive, it outputs like this <PARA xmlns="">
Here is a small chunk of my xslt
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions" exclude-result-
prefixes="xs fn" xmlns:ACM="www.mydomain.com">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:variable name="XML1" select="/"/>
<xsl:template match="/">
<xsl:for-each select="//title">
<xsl:variable name="title" select="."/>
<xsl:apply-templates select="document(.)"/>
</xsl:for-each>
<xsl:result-document href="c:\temp\{subsequence(reverse(tokenize(document-uri(.), '\\')), 1, 1)}">
<xsl:apply-templates/>
</xsl:result-document>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:choose>
<xsl:when test="@*">
<xsl:copy-of select="@*"/>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="id"><xsl:value-of select="generate-id()"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="ACM:Sec1">
<ACM:SEC1>
<xsl:apply-templates/>
</ACM:SEC1>
</xsl:template>
<xsl:template match="ACM:sec2">
<ACM:SEC2>
<xsl:apply-templates/>
</ACM:SEC2>
</xsl:template>
<xsl:template match="ACM:sec3">
<ACM:SEC3>
<xsl:apply-templates/>
</ACM:SEC3>
</xsl:template>
<xsl:template match="ACM:Para">
<xsl:element name="PARA">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
I hope I explained my issue properly.
Thanks for the help.