2013-01-11 13 views
10

मैं इस सरल एक्सएमएल दस्तावेज़:xpath-default-नाम स्थान के साथ XSL XPaths में इस्तेमाल के लिए एक डिफ़ॉल्ट नाम स्थान को परिभाषित करें

<?xml version="1.0" encoding="UTF-8"?> 
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="http://www.iana.org/assignments" version="1.0"> 
    <xsl:template match="/my:registry"> 
     <xsl:copy-of select="//my:record/my:name"/> 
    </xsl:template> 
</xsl:stylesheet> 

:

<?xml version='1.0' encoding='UTF-8'?> 
<registry xmlns="http://www.iana.org/assignments" id="character-sets"> 
    <registry id="character-sets-1"> 
     <record> 
     <name>ANSI_X3.4-1968</name> 
     </record> 
    </registry> 
</registry> 

जब मैं इस XSL का उपयोग मैं नाम निकाल सकते हैं

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="http://www.iana.org/assignments" xpath-default-namespace="http://www.iana.org/assignments" version="1.0"> 
    <xsl:template match="/registry"> 
     <xsl:copy-of select="//record/name"/> 
    </xsl:template> 
</xsl:stylesheet> 

मैं सोचा xpath-default-नाम स्थान का मतलब है: हालांकि, अगर मैं XSL xpath-चयनकर्ताओं में नाम स्थान को छोड़ देते हैं, मुझे कोई आउटपुट प्राप्त चाल चलो। मैं क्या खो रहा हूँ?

मामले पुस्तकालय संस्करणों में महत्वपूर्ण रहा

libexpat1 (> = 1.95.8)

libxerces-c3.1

libxml2 (> = 2.7.4)

libxslt1 है .1 (> = 1.1.25)

उत्तर

13

दुर्भाग्यवश xpath-default-namespace एक एक्सएसएलटी 2.0 सुविधा है। आप में xslt 1.0

संदर्भ अपने xpath में नाम स्थान या यह उर्फ ​​दोहराने की आवश्यकता होगी: Jenni Tennison और IBM

+0

हाँ, अब मुझे लगता है कि libxslt1.1 का समर्थन नहीं करता 'xpath-default-namespace' धन्यवाद ! – JohnDoe

+0

कोई भी 'xplt' संस्करण 1.0 में 'xpath-default-namespace' को परिभाषित कैसे कर सकता है? – pkaramol

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