Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl problems (maybe an namespace issue?)

Status
Not open for further replies.

mclosson

Programmer
Mar 19, 2001
24
CA
I have an xsl file:

<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl:eek:utput method="xml"/>
<xsl:template match="svg">
<xsl:apply-templates select="mask"/>
</xsl:template>
<xsl:template match="mask">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

that I'm trying to use to transform an xml file:

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns=" xmlns:xlink=" xmlns:gmwmsvg=" <mask id="gwmmask">
<rect id="gwmmaskrect" x="0" y="0" width="20480" height="15360" style="fill:white"/>
</mask>
<g>
<rect id="gwmbg" x="-204800" y="-153600" width="430080" height="322560" style="fill:#ebebeb"/>
<g>
<path/>
<path/>
<path/>
</g>
</g>
</svg>


My goal is to select only the "mask" section in the results, as follows:

<mask id="gwmmask">
<rect id="gwmmaskrect" x="0" y="0" width="20480" height="15360" style="fill:white"/>
</mask>

When I try, with the xsl as above, I get no results. The only way I can get results is to use <xsl:template match="/"><xsl:copy-of select="."/></xsl:template> in the xsl (and then I get everything - not what I'm looking for). I'm thinking my problem may be the namespaces used in the <svg> node of the xml file, as it all works if I take them out. For my situation, they will need to stay in though. If anyone has any ideas, please let me know.


Thanks,

Mike
 
Why dont you try:

Code:
<xsl:template match="/">
	<xsl:copy-of select="svg/mask" />
</xsl:template>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top