मेरे पास एक एक्सएसएलटी है जो कुछ विशेषताओं से मेल खाता है, और उन्हें एक अलग नामस्थान में रखता है।सफारी एक्सएसएलटी इंजन गुणों पर नामस्थान खो देता है
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="urn:test:ns1"
xmlns:ns2="urn:test:ns2">
<xsl:output method="xml" indent="no" encoding="UTF-8"/>
<!-- copy all nodes -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*[starts-with(local-name(), 'test-')]">
<xsl:attribute name="ns2:{substring-after(local-name(), '-')}" namespace="urn:test:ns2">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
यहाँ है कुछ उदाहरण इनपुट:
<?xml version="1.0" encoding="UTF-8" ?>
<hello-world
xmlns="urn:test:ns1"
xmlns:ns3="urn:test:ns3"
rootAttr="stays in implicit namespace"
ns3:passMe="stays in the ns3 namespace"
test-someRootAttr="goes into the ns2 namespace, pulls up ns declaration">
<test
defaultAttr="stays in implicit namespace"
test-someAttr="goes into the ns2 namespace"
ns3:namedAttr="stays in the ns3 namespace">
Something
</test>
<ns3:cat
defaultAttr="stays in the implicit namespace"
test-catName="goes into the ns2 namespace"
ns3:namedAttr="stays in the ns3 namespace">
a cat
</ns3:cat>
</hello-world>
और यहाँ है उम्मीद उत्पादन:
<?xml version="1.0" encoding="UTF-8" ?>
<hello-world
xmlns="urn:test:ns1"
xmlns:ns2="urn:test:ns2"
xmlns:ns3="urn:test:ns3"
rootAttr="stays in implicit namespace"
ns3:passMe="stays in the ns3 namespace"
ns2:someRootAttr="goes into the ns2 namespace, pulls up ns declaration">
<test
defaultAttr="stays in implicit namespace"
ns2:someAttr="goes into the ns2 namespace"
ns3:namedAttr="stays in the ns3 namespace">
Something
</test>
<ns3:cat
defaultAttr="stays in the implicit namespace"
ns2:catName="goes into the ns2 namespace"
ns3:namedAttr="stays in the ns3 namespace">
a cat
</ns3:cat>
</hello-world>
यह क्रोम, Firefox, IE 9 पर ठीक काम करता है यहाँ एक सरलीकृत संस्करण है +, और एंड्रॉइड। हालांकि सफारी पर, मैं निम्नलिखित उत्पादन बजाय:
<?xml version="1.0" encoding="UTF-8" ?>
<hello-world
xmlns="urn:test:ns1"
xmlns:ns3="urn:test:ns3"
xmlns:ns2="urn:test:ns2"
rootAttr="stays in implicit namespace"
passMe="stays in the ns3 namespace"
someRootAttr="goes into the ns2 namespace, pulls up ns declaration">
<test
defaultAttr="stays in implicit namespace"
someAttr="goes into the ns2 namespace"
namedAttr="stays in the ns3 namespace">
Something
</test>
<ns3:cat
defaultAttr="stays in the implicit namespace"
catName="goes into the ns2 namespace"
namedAttr="stays in the ns3 namespace">
a cat
</ns3:cat>
</hello-world>
सूचना है कि नाम स्थान घोषणाओं सही हैं, लेकिन गुण वांछित नामस्थान उपसर्ग याद कर रहे हैं।
यह सब कोड github project में है, जो TravisCI द्वारा बनाया गया है और विभिन्न ब्राउज़र/ओएस combos पर परीक्षण के लिए Sauce Labs का उपयोग करता है।
क्या मैं अपने एक्सएसएलटी के साथ कुछ अलग कर सकता हूं जो इसे पूरा करने का एक और सही तरीका होगा, जो सभी इंजनों पर काम कर सकता है? या यह सफारी में बस एक बग है? कामकाज के लिए किसी भी विचार की सराहना की जाएगी।
यदि आप केवल पहचान टेम्पलेट लागू करते हैं तो सफारी परिणाम क्या है? आउटपुट समान/स्रोत एक्सएमएल दस्तावेज़ के बराबर है? यदि आउटपुट सही है, तो क्या होता है जब आप एक डिलीटिंग टेम्पलेट (खाली निकाय के साथ) जोड़ते हैं जो "test-" से शुरू होने वाले स्थानीय-नाम() के साथ किसी भी विशेषता से मेल खाता है? मैं सफारी के साथ या बस अपने एक्सएसएलटी इंजन के साथ एक्सएसएलटी रूपांतरण कैसे चला सकता हूं? –
क्या आप कुछ जावास्क्रिप्ट के माध्यम से परिवर्तन कर रहे हैं, या आप ' Xml-styleheet ..?> ' – Flynn1179
का उपयोग कर जुड़े एक्सएसएलटी के साथ स्रोत दस्तावेज़ खोल रहे हैं विंडोज़ के लिए सफारी 5.1.7 (7534.57.2) में ठीक काम करने लगता है (x86)। आपके द्वारा कौन सा संस्करण उपयोग किया जा रहा है? ओएस एक्स – Flynn1179