Subject: RE: [xsl] variable holding a xml document created by xslt From: "M. David Peterson" <m.david@xxxxxxxxxx> Date: Sun, 11 Apr 2004 03:09:25 -0600 |
Hey Robert, In fact I believe I remember our conversation from last year. Im glad to see that the lookup table has been of some help to you. You are correct in how you would access the value of the variable. But in this particular case you are going to need to use the node-set function of msxsl to give you what you need. To do this you will need to declare the msxsl namespace as a part of your stylesheet decleration like so... <xsl:stylesheet version = "1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes = "msxsl"> Next, you will need to create a variable that contains the dynamic values you want. <xsl:variable name="getLookupValuesforRect"> <xsl:element name="label"> <xsl:attribute name="x1">100</xsl:attribute> <xsl:attribute name="x2">110</xsl:attribute> </xsl:element> </xsl:variable> Finally, create another variable that you will call the node-set function from within the select attribute. You will then you the method you describe to access its content. <xsl:variable name="get-rect" select="msxsl:node-set($getLookupValuesforRect)/> If the size of the xml tree was reasonable you could just use one variable like so: <xsl:variable name="get-rect" select="msxsl:node-set('<label x1="100" x2="110">')/> But its easy to see how this method could become unmanageable fairly quickly... Either way using "$get-rect/label/@x1" will get you the value of attribute x1. Hope this helps! Best regards, <M:D/> -----Original Message----- From: Robert Van Gemert [mailto:rcvangemert@xxxxxxxxxxxxxxxx] Sent: Sunday, April 11, 2004 2:47 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] variable holding a xml document created by xslt Thanks David, Confused? yep! You showed me the lookup idea last year and I use it now for constants but in this case the lookup list will change depending on what lables are in view, so the list needs to be created dynamically. I am using msxml4, I think you are suggesting that if I create a template that returns a xml fragment eg. <template name="get-rect" <xsl:value-of select> <lable> <xsl:attribute name="x1">100</xsl:attribute> <xsl:attribute name="x2">110</xsl:attribute> <lable> </xsl:value-of select> </template> I can access this fragment using <xsl:variable name="lable-rect"> <xsl:call-template name="get-rect"/> <xsl:variable> $lable-rect/@x1 -RVG
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] variable holding a xml do, Robert Van Gemert | Thread | Re: [xsl] variable holding a xml do, Robert Van Gemert |
Re: [xsl] variable holding a xml do, Robert Van Gemert | Date | Re: [xsl] variable holding a xml do, Robert Van Gemert |
Month |