Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Re: Defining a Variable that depends on an unknown number of conditions

From: "Michael Kay" <mike@------------>
To:
Date: 1/1/2009 5:21:00 PM
> OK.  I'm trying to determine if element_x or element_y 
> contain the value value_m or value_n.
> I believe I'm close, but can't figure out what to replace 
> ____________ with.
> I tried current()/../@on and ./../@on but no luck.
> 
> Thanks.  Below is a quick mock-up of files.
> 
> I have xml_a.xml as so:
> <xml_a>
>   <depends>
>     <depend on="element_x" equals="value_m|value_n"/>
>     <depend on="element_y" equals="value_m|value_n"/>
>   </depends>
> </xml_a>
> 
> and xml_b.xml:
> <xml_b>
>   <element_x>value_m</element_x>
>   <element_y>value_p</element_y>
> </xml_b>
> 
> finally transform.xsl, that opens xml_b.xml and transforms xml_a.xml.
> <xsl:variable name="xml_b" select="document('xml_b.xml')/xml_b"/>
> <xml:template select="xml_a">
>   <xsl:variable name="my_test" select =
> "depends/depend/@equals[contains(.,$xml_b/*[name()=__________])]"/>
> </xml:template>

I don't think you can do this join in a single XPath 1.0 expression. It
either needs XPath 2.0, or some kind of xsl:for-each logic if you really
must do it in XSLT 1.0.

Michael Kay
http://www.saxonica.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent