Subject: [xsl] Data Recursion created by References From: "bix xslt" <bix_xslt@xxxxxxxxxxx> Date: Thu, 10 Apr 2003 20:47:48 +0000 |
<object name="someObjectName"> <childRef name="someReferenceToAnObject"/> </object>
<object name="a"> <childRef name="b"/> <childRef name="c"/> <object name="b"><childRef name="a"/></object> <object name="c"><childRef name="d"/></object> <object name="d"><childRef name="b"/></object> </object>
If I modified the xml slightly, there is an alternative problem: <object name="a"> <childRef name="b"/> <childRef name="c"/> <object name="b"><childRef name="c"/></object> <object name="c"><childRef name="d"/></object> <object name="d"/> </object>
How do I distinguish between: a -> b -> c -> d and a -> d
Thanks, bix
The following is my XSL. <!-- xmlns:exslt="urn:schemas-microsoft-com:xslt" --> <!-- xmlns:exslt="http://www.exslt.org" -->
<x:stylesheet version="1.0" xmlns:x="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="urn:schemas-microsoft-com:xslt"
<x:key name="objectsKey" match="object" use="@name"/> <x:key name="childrenKey" match="object" use="childRef/@name"/> <x:param name="startNodeName" select="'d'"/> <x:param name="topNodeName" select="'a'"/> <x:param name="startNode" select="//object[@name = $startNodeName]"/> <x:param name="topNode" select="//object[@name = $topNodeName]"/>
<x:attribute-set name="hiddenTable"> <x:attribute name="border">0</x:attribute> <x:attribute name="cellspacing">0</x:attribute> <x:attribute name="cellpadding">0</x:attribute> </x:attribute-set>
<x:attribute-set name="fillWindow"> <x:attribute name="style">margin: 0;</x:attribute> </x:attribute-set>
<x:template match="object"> <x:element name="html"> <x:element name="head"> <x:element name="title">Autogenerated Webview</x:element> <x:element name="style"> <![CDATA[ a {text-decoration:none} ]]> </x:element> <x:element name="script"> <![CDATA[ var xmlObj = null; var xslObj = null; var xformer = null;
function getXMLObj(xmlFileName) { xmlObj = new ActiveXObject("Msxml2.DOMDocument.4.0"); xmlObj.async = false; xmlObj.validateOnParse = true; xmlObj.load(xmlFileName); return xmlObj; }
function getXSLObj(xslFileName) { xslObj = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0"); xslObj.async = false; xslObj.validateOnParse = true; xslObj.load(xslFileName); return xslObj; }
function getTransformer(xmlObject, xslObject) { var template = new ActiveXObject("MSXML2.XSLTemplate.4.0"); template.stylesheet = xslObject.documentElement; var transformer = template.createProcessor(); transformer.input = xmlObject; return transformer; }
function init() { xmlObj = getXMLObj("temp.xml"); xslObj = getXSLObj("temp.xsl"); }
function refresh(id,w) { var xformer = getTransformer(xmlObj,xslObj); xformer.addParameter("startNodeName", id, ""); xformer.transform(); w.write(xformer.output); w.close(); } ]]> </x:element> </x:element> <x:element name="body" use-attribute-sets="fillWindow"> <x:attribute name="onload">javascript:init()</x:attribute> <x:element name="table" use-attribute-sets="hiddenTable"> <x:element name="tr"> <x:element name="td"> <x:call-template name="makePath"> <x:with-param name="currNode" select="$startNode"/> </x:call-template> </x:element> </x:element> </x:element> </x:element> </x:element> </x:template>
<x:template name="addSpacer">   <x:element name="font"> <x:attribute name="face">Wingdings</x:attribute>ð</x:element>   </x:template> </x:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] An eseay question., Passin, Tom | Thread | RE: [xsl] String manipulations with, David Christiansen |
[xsl] Re: parsing a long string int, Dimitre Novatchev | Date | RE: [xsl] An eseay question., Tham Tinh |
Month |