|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem applying XSL to XML that uses a schema
Hi Tim,
The problem is that you have two different input documents. In the first case that works all the elements are in no namespace while in the second case that does not work all the elements are in the http://www.mydomain.com/mainelement namespace. When you use an element name in an XPath expression without specifying a prefix that is considered from no namespace. In order to match your elements from the http://www.mydomain.com/mainelement namespace you need to map a prefix to this namespace and use that when you refer to elements from that namespace, something like below: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="http://www.mydomain.com/mainelement"> <xsl:output method="xml" version="1.1" indent="yes" /> <xsl:template match="comment()">
<xsl:comment><xsl:value-of select="."/></xsl:comment>
</xsl:template> <xsl:template match="t:subelement|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template> <xsl:template match="t:mainelement|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/> <xsl:comment >NewSubComment1.1</xsl:comment>
<xsl:text>
</xsl:text>
<subelement name="newsub">content</subelement>
<xsl:comment >NewSubComment1.2</xsl:comment>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>Best Regards, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com tim@xxxxxxxxxxx wrote: Hello,
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








