का उपयोग कर मैं देख रहा हूं कि सैक्सन 9.1.0.7 का उपयोग करके काम कर रहे एक साधारण बाहरी लुकअप को प्राप्त करने का प्रयास कर मेरे बालों से क्या बचा है।एक्सएसएलटी 2.0 बाहरी लुकअप कुंजी() और दस्तावेज़()
<something>
<monkey>
<genrecode>AAA</genrecode>
</monkey>
<monkey>
<genrecode>BBB</genrecode>
</monkey>
<monkey>
<genrecode>ZZZ</genrecode>
</monkey>
<monkey>
<genrecode>ZER</genrecode>
</monkey>
</something>
तब देखने फ़ाइल है GenreSet_124.xml:
मैं एक साधारण स्रोत फ़ाइल dummy.xml है
<GetGenreMappingObjectsResponse>
<tuple>
<old>
<GenreMapping DepartmentCode="AAA"
DepartmentName="AND - NEWS AND CURRENT AFFAIRS"
Genre="10 - NEWS"/>
</old>
</tuple>
<tuple>
<old>
<GenreMapping DepartmentCode="BBB"
DepartmentName="AND - NEWS AND CURRENT AFFAIRS"
Genre="11 - NEWS"/>
</old>
</tuple>
... lots more
</GetGenreMappingObjectsResponse>
मैं क्या ' मैं हासिल करने की कोशिश कर रहा हूं बस "शैली" पकड़ने के लिए है "विभाग" कोड के आधार पर मूल्य।
तो मेरी XSL लगता है:
...
<!-- Set up the genre lookup key -->
<xsl:key name="genre-lookup" match="GenreMapping" use="@DepartmentCode"/>
<xsl:variable name="lookupDoc" select="document('GenreSet_124.xml')"/>
<xsl:template match="/something">
<stuff>
<xsl:for-each select="monkey">
<Genre>
<xsl:apply-templates select="$lookupDoc">
<xsl:with-param name="curr-label" select="genrecode"/>
</xsl:apply-templates>
</Genre>
</xsl:for-each>
</stuff>
</xsl:template>
<xsl:template match="GetGenreMappingObjectsResponse">
<xsl:param name="curr-genrecode"/>
<xsl:value-of select="key('genre-lookup', $curr-genrecode)/@Genre"/>
</xsl:template>
...
मुद्दा रहा है कि मैं कुछ भी नहीं वापस पाने के लिए है। मैं वर्तमान में सिर्फ जब भी मैं टेम्पलेट मैच = प्रवेश किया "GetGenreMappingObjectsResponse" यह सिर्फ बाहर सभी पाठ हर GenreMapping से प्रिंट होगा GenreMapping के बच्चे तत्व के रूप में
<?xml version="1.0" encoding="UTF-8"?>
<stuff>
<Genre/>
<Genre/>
<Genre/>
<Genre/>
</stuff>
मैं GenreMapping की विशेषताओं होने के लिए सभी देखने डेटा स्थानांतरित कर दिया हो, पहले से (विभाग कोड, विभाग नाम, शैली)!
मैं अपने जीवन के लिए यह नहीं समझ सकता कि मैं क्या गलत कर रहा हूं। किसी भी मदद/सुझावों की सराहना की जाएगी।
कृपया वर्तमान वास्तविक XSLT सूची पाते हैं:।
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Define the global parameters -->
<xsl:param name="TransformationID"/>
<xsl:param name="TransformationType"/>
<!-- Specify that XML is the desired output type -->
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<!-- Set up the genre matching capability -->
<xsl:key name="genre-lookup" match="GenreMapping" use="@DepartmentCode"/>
<xsl:variable name="documentPath"><xsl:value-of select="concat('GenreSet_',$TransformationID,'.xml')"/></xsl:variable>
<xsl:variable name="lookupDoc" select="document($documentPath)"/>
<!-- Start the first match on the Root level -->
<xsl:template match="/something">
<stuff>
<xsl:for-each select="monkey">
<Genre>
<xsl:apply-templates select="$lookupDoc/*">
<xsl:with-param name="curr-genrecode" select="string(genrecode)"/>
</xsl:apply-templates>
</Genre>
</xsl:for-each>
</stuff>
</xsl:template >
<xsl:template match="GetGenreMappingObjectsResponse">
<xsl:param name="curr-genrecode"/>
<xsl:value-of select="key('genre-lookup', $curr-genrecode, $lookupDoc)/@Genre"/>
</xsl:template>
</xsl:stylesheet>
TransformationID alway 124 है (ताकि सही देखने फ़ाइल खोला है प्रकार सिर्फ एक नाम है कि मैं वर्तमान में उपयोग नहीं कर रहा है, लेकिन के लिए इच्छुक है
।एक key
समारोह के तीन पैरामीटर संस्करण है तीसरे पैरामीटर आप रूट नोड आप कुंजी पर काम करना चाहता (निर्दिष्ट कर सकते हैं:
क्या एक्सएसएलटी कंपाइलर आप उपयोग कर रहे हैं? – Welbog
सैक्सन-बी 9.1.0.7 –
आंकड़े। मैं उस से परिचित नहीं हूँ। शायद बाद में तोमालक आ जाएगा और आपकी मदद करेगा। क्या चाबी रहित विधि काम करती है? – Welbog