[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Embedded Documentation
Hello, I'm working on a scheme to embed documentation for global parameters within a stylesheet. The purpose of this to provide additional information that another stylesheet can use in order to automatically generate an HTML form. I've worked out an approach, and would welcome comments on whether this is proper, as well as suggestions on better ways to accomplish the same thing. from the spec... 2.1 XSLT Namespace (paragraph 2) An element from the XSLT namespace may have any attribute not from the XSLT namespace, provided that the expanded name of the attribute has a non-null namespace URI. The presence of such attributes must not change the behavior of XSLT elements and functions defined in this document. Thus, an XSLT processor is always free to ignore such attributes, and must ignore such attributes without giving an error if it does not recognize the namespace URI. Such attributes can provide, for example, unique identifiers, optimization hints, or documentation. So here I would define a new namespace and use a set of attributes to describe the parameter, such as: <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"> <xsl:param name="fsize" xmlns:pd="" pd:type="font-size">12</xsl:param> <xsl:template match="/"> <test> <xsl:value-of select="$fsize"/> </test> </xsl:template> </xsl:stylesheet> Now would it be proper to bind the 'pd' namespace to another XML file that contains a description of 'font-size'? I could then get a full description of the 'font-size' type and use that to build a proper form element for changing the value of this parameter. I could also have a set of different types defined in different files and have each one bound to a different namespace. One problem with this is that each <xsl:param> has to have the namespace declaration. If I move the namespace declaration up to the <xsl:stylesheet> element, then the result elements end up inheriting this declaration, which I don't want to happen. For example: <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns:pd=""> <xsl:param name="fsize" pd:type="font-size">12</xsl:param> <xsl:template match="/"> <test> <xsl:value-of select="$fsize"/> </test> </xsl:template> </xsl:stylesheet> yeilds: <test xmlns:pd="">12</test> Thanks, Dan Machak -- <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> <> Dan Machak <> machak@xxxxxxxxxxxx <> <> MS T27A-1 <> 650-604-2388 (VOICE) <> <> NASA Ames Research Center <> 650-604-3957 (FAX) <> <> Moffett Field, CA 94035-1000 <> <> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|