[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] processing xml data with default namespace
hey list,
i'm trying to process xml data that has a default namespace: <--- snip: test.xml ---> <?xml version="1.0" encoding="utf-8"?> <foo xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.patexpert.org/ont/metaont#"> <bar rdf:about="#id">argh</bar> </foo> <--- snip ---> processing this data with the stylesheet <--- snip: test1.xsl ---> <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pat="http://www.patexpert.org/ont/metaont#" exclude-result-prefixes="pat" version="2.0"> <xsl:output method="xml" version="1.0" indent="yes" encoding="utf-8" /> <xsl:template match="pat:foo"> <xsl:element name="bar" namespace="http://www.patexpert.org/ont/metaont#"> </xsl:element> </xsl:template> </xsl:stylesheet> <--- test1.xsl ---> yields the (expected) result <--- snip:output1 ---> <?xml version="1.0" encoding="utf-8"?> <bar xmlns="http://www.patexpert.org/ont/metaont#"/> <--- snip ---> i was trying to replace the xsl:element tags with a more direct <--- snip:test2.xsl ---> <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pat="http://www.patexpert.org/ont/metaont#" exclude-result-prefixes="pat" version="2.0"> <xsl:output method="xml" version="1.0" indent="yes" encoding="utf-8" /> <xsl:template match="pat:foo"> <pat:bar> </pat:bar> </xsl:template> </xsl:stylesheet> <--- snip ---> but i am getting <--- snip: output2 ---> <?xml version="1.0" encoding="utf-8"?> <pat:bar xmlns:pat="http://www.patexpert.org/ont/metaont#"/> <--- snip ---> i was expecting to get the same result as in output1. why is pat:bar apparently not the same as the xsl:element instruction above? thanks, achim.
|
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
|