Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • sateesh 1 post 71 karma points
    May 03, 2020 @ 09:41
    sateesh
    0

    Dynamic pass the arguments to XSLT to get xmlMy ref Xmlmy ref XsltMy ref Xmlmy ref Xslt

    Hi Team,

    Am trying to create new xml doc , with using xslt in C#. i want to change my xslt parameter values dynamically,

    My ref Xml

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="SimpleKey.xsl"?>
    <Cities Source="http://www.city-data.com/top1.html">
        <City State="NY" Population="8084316">New York</City>
        <City State="CA" Population="3798981">Los Angeles</City>
        <City State="IL" Population="2886251">Chicago</City>
        <City State="TX" Population="2009834">Houston</City>
        <City State="PA" Population="1492231">Philadelphia</City>
        <City State="AZ" Population="1371960">Phoenix</City>
        <City State="CA" Population="1259532">San Diego</City>
        <City State="TX" Population="1211467">Dallas</City>
        <City State="TX" Population="1194222">San Antonio</City>
    </Cities>
    

    my ref Xslt

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml" indent="yes"/>
        <xsl:key name="keyCity" match="City" use="@State"/>
        <xsl:param name="State" select="'NY'"/>
        <xsl:template match="/">
    
                <xsl:for-each select="key('keyCity',$State)">
                    <xsl:copy-of select="current()"/>
                </xsl:for-each>
    
        </xsl:template>
    </xsl:stylesheet>
    

    how can pass the Select value dynamically.

    thanks for advance.

Please Sign in or register to post replies

Write your reply to:

Draft