2015-10-21 7 views
10

मेरे पास एक एक्सएसएलटी है जो कुछ विशेषताओं से मेल खाता है, और उन्हें एक अलग नामस्थान में रखता है।सफारी एक्सएसएलटी इंजन गुणों पर नामस्थान खो देता है

<?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 का उपयोग करता है।

क्या मैं अपने एक्सएसएलटी के साथ कुछ अलग कर सकता हूं जो इसे पूरा करने का एक और सही तरीका होगा, जो सभी इंजनों पर काम कर सकता है? या यह सफारी में बस एक बग है? कामकाज के लिए किसी भी विचार की सराहना की जाएगी।

+0

यदि आप केवल पहचान टेम्पलेट लागू करते हैं तो सफारी परिणाम क्या है? आउटपुट समान/स्रोत एक्सएमएल दस्तावेज़ के बराबर है? यदि आउटपुट सही है, तो क्या होता है जब आप एक डिलीटिंग टेम्पलेट (खाली निकाय के साथ) जोड़ते हैं जो "test-" से शुरू होने वाले स्थानीय-नाम() के साथ किसी भी विशेषता से मेल खाता है? मैं सफारी के साथ या बस अपने एक्सएसएलटी इंजन के साथ एक्सएसएलटी रूपांतरण कैसे चला सकता हूं? –

+0

क्या आप कुछ जावास्क्रिप्ट के माध्यम से परिवर्तन कर रहे हैं, या आप ' ' – Flynn1179

+0

का उपयोग कर जुड़े एक्सएसएलटी के साथ स्रोत दस्तावेज़ खोल रहे हैं विंडोज़ के लिए सफारी 5.1.7 (7534.57.2) में ठीक काम करने लगता है (x86)। आपके द्वारा कौन सा संस्करण उपयोग किया जा रहा है? ओएस एक्स – Flynn1179

उत्तर

1

इसके विपरीत किसी भी सबूत के बिना, यह सफारी में एक बग प्रतीत होता है। मैंने ऐप्पल (rdar://23207226) को इसकी सूचना दी है, लेकिन अब तक उनसे कुछ भी नहीं सुना है।

एकमात्र उपलब्ध वर्कअराउंड एक्सएसएलटी को किसी अन्य इंजन (सर्वर पक्ष, या शायद किसी तृतीय पक्ष जावास्क्रिप्ट इंजन के माध्यम से) चलाने के लिए है।

1

मुझे लगता है कि यह एक बग है। आपके आस-पास के काम के रूप में आप जिस नामस्थान को xsl:attribute namespace="urn:test:ns2" पर सेट करना चाहते हैं उसे सेट करने का प्रयास कर सकते हैं।

+0

इसका प्रयास किया, और इससे कोई फर्क नहीं पड़ता।मैंने इसे शामिल करने के लिए अपना प्रश्न अपडेट किया। फिर भी सुझाव के लिए धन्यवाद। मैं मानता हूं कि यह एक सफारी बग की तरह दिखता है। – murrayju

+0

क्या होता है यदि आप नामस्थान घोषणा 'xmlns: ns2 = "urn: test: ns2" '' xsl: विशेषता' पर भी डालते हैं? –

+0

भी कोई फर्क नहीं पड़ता। खुशी है कि यह नहीं था, यह अनावश्यक होता। – murrayju

संबंधित मुद्दे