xslt - Varying xpath-default-namespace in XML source files -
I have a set of XML files which I am processing with XSL transforms. They have a default namespace, so there should be a manifest code in my XSL transmitt:
xpath-default-namespace = "vase: Seas-RVV-IS-VAV-XML-ns: data-1.2.2"
The problem is that this value changes from time to time, and my change suddenly stops, as long as I do not see an example from the new file, I remove the name of this name and Let me put this into a conversion, to convert the old file Is it a way to pass it as a parameter, or is it set in any order? I have tried those parameter syntax which I had seen in various tutorials, but have not done any work for this particular use.
I have searched for all types of forums and found in the context of namespace - XSL's ignorant coding, but did not know how to do it in the book "XSLT and Expedition" by Ian Williams That the default namespace should be declared, or you do not find anything in the output stream, which is how it works for me, but I do not really want to change it manually by hand, I I want to give something to the user who works without the need to constantly focus on me.
I have invented only 100% reliable way, using standard programming language to convert both XML source and XSL to text files, extract url from XML source, paste it Turn off both the XSL Transformation, and then, actually run the actual transform. It works, but at least for my taste, incredibly durky. How can I treat better by changing the default namespace?
The value of Xpath-default-namespace should be a static URI, So if you want to differentiate it then you have to pre-process the stylesheet. One way to do this is to use XSLT, apply the following meta-stylesheet to your primary stylesheet, and then use the pre-processed result instead Open
& lt; Xsl: stylesheet version = "2.0" xmlns: xsl = "http: //www.w3.org/1999/XSL/Transform"> & Lt ;! - Pass the new namespace URI as the stylesheet parameter - & gt; & Lt; Xsl: Ultimate Name = "New-Yuri" required = "Yes" /> & Lt; / XSL: Copy & gt; & Lt; / XSL: Templates & gt; & Lt ;! - but @ xpath-default-namespace - & gt; Update the value of & lt; Xsl: template match = "@xpath-default-namespace" & gt; & Lt; Xsl: attribute name = "{name ()}" name space = "{namespace-yuri ()}" & gt; & Lt; Xsl: Select Value = "$ New-Yuri" /> & Lt; / XSL: Specialty & gt; & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;
This is a bit of a weird use case, however, because the namespace was not really designed to be so dynamic. They were designed to qualify the name, that is, to make a part of a name. When you see it this way, the dynamic namespace is very important. Imagine a database whose table and field names are changed every time once every time, and to maintain the changes, you have to rewrite all your SQL scripts, this is the same as <
Comments
Post a Comment